mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Improve extension map
This commit is contained in:
parent
449da348c0
commit
7f951c9333
@ -82,7 +82,7 @@ Function Add-Extension {
|
||||
|
||||
# Function to get a map of extensions and their dependent shared extensions.
|
||||
Function Get-ExtensionMap {
|
||||
php -d'error_reporting=0' $dist\..\src\scripts\extensions\extension_map.php $env:TEMP\map.orig
|
||||
php -d'error_reporting=0' $dist\..\src\scripts\extensions\extension_map.php $env:TEMP\map$version.orig
|
||||
}
|
||||
|
||||
# Function to enable extension dependencies which are also extensions.
|
||||
@ -98,7 +98,7 @@ Function Enable-ExtensionDependencies {
|
||||
return
|
||||
}
|
||||
Get-ExtensionMap
|
||||
$entry = findstr /r "$extension`:.*" $env:TEMP\map.orig
|
||||
$entry = findstr /r "$extension`:.*" $env:TEMP\map$version.orig
|
||||
if($entry) {
|
||||
$entry.split(':')[1].trim().split(' ') | ForEach-Object {
|
||||
if (-not(php -m | findstr -i $_)) {
|
||||
@ -118,7 +118,7 @@ Function Disable-DependentExtensions() {
|
||||
[string]
|
||||
$extension
|
||||
)
|
||||
Select-String -Pattern ".*:.*\s$extension(\s|$)" $env:TEMP\map.orig | ForEach-Object {
|
||||
Select-String -Pattern ".*:.*\s$extension(\s|$)" $env:TEMP\map$version.orig | ForEach-Object {
|
||||
$dependent = $_.Matches[0].Value.split(':')[0];
|
||||
Disable-ExtensionHelper -Extension $dependent -DisableDependents
|
||||
Add-Log $tick ":$extension" "Disabled $dependent as it depends on $extension"
|
||||
|
@ -49,7 +49,7 @@ enable_extension() {
|
||||
|
||||
# Function to get a map of extensions and their dependent shared extensions.
|
||||
get_extension_map() {
|
||||
php -d'error_reporting=0' "${dist:?}"/../src/scripts/extensions/extension_map.php /tmp/map.orig
|
||||
php -d'error_reporting=0' "${dist:?}"/../src/scripts/extensions/extension_map.php /tmp/map"$version".orig
|
||||
}
|
||||
|
||||
# Function to enable extension dependencies which are also extensions.
|
||||
@ -58,7 +58,7 @@ enable_extension_dependencies() {
|
||||
prefix=$2
|
||||
[ -e /tmp/extdisabled/"$version"/"$extension" ] || return;
|
||||
get_extension_map
|
||||
for dependency in $(grep "$extension:" /tmp/map.orig | cut -d ':' -f 2 | tr '\n' ' '); do
|
||||
for dependency in $(grep "$extension:" /tmp/map"$version".orig | cut -d ':' -f 2 | tr '\n' ' '); do
|
||||
enable_extension "$dependency" "$prefix"
|
||||
done
|
||||
rm /tmp/extdisabled/"$version"/"$extension"
|
||||
@ -67,7 +67,7 @@ enable_extension_dependencies() {
|
||||
# Function to disable dependent extensions.
|
||||
disable_extension_dependents() {
|
||||
local extension=$1
|
||||
for dependent in $(grep -E ".*:.*\s$extension(\s|$)" /tmp/map.orig | cut -d ':' -f 1 | tr '\n' ' '); do
|
||||
for dependent in $(grep -E ".*:.*\s$extension(\s|$)" /tmp/map"$version".orig | cut -d ':' -f 1 | tr '\n' ' '); do
|
||||
disable_extension_helper "$dependent" true
|
||||
add_log "${tick:?}" ":$extension" "Disabled $dependent as it depends on $extension"
|
||||
done
|
||||
|
@ -31,7 +31,7 @@ class ExtensionMap {
|
||||
/**
|
||||
* Function to read the extension map.
|
||||
*/
|
||||
public function parseMap($path) {
|
||||
private function parseMap($path) {
|
||||
if(file_exists($path)) {
|
||||
$handle = fopen($path, "r");
|
||||
if ($handle) {
|
||||
@ -50,7 +50,7 @@ class ExtensionMap {
|
||||
* @param string $extension
|
||||
* @return bool
|
||||
*/
|
||||
public function checkSharedExtension($extension) {
|
||||
private function checkSharedExtension($extension) {
|
||||
$extension_file = $this->extension_dir. DIRECTORY_SEPARATOR . $this->file_prefix . $extension . $this->file_extension;
|
||||
return file_exists($extension_file);
|
||||
}
|
||||
@ -60,7 +60,7 @@ class ExtensionMap {
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSharedExtensions() {
|
||||
private function getSharedExtensions() {
|
||||
$files = scandir($this->extension_dir);
|
||||
$extensions = array_diff($files, array('.','..'));
|
||||
$filter_pattern = "/$this->file_extension|$this->file_prefix/";
|
||||
@ -76,7 +76,7 @@ class ExtensionMap {
|
||||
* @param array $dependencies
|
||||
* @return array
|
||||
*/
|
||||
public function patchDependencies($extension, $dependencies) {
|
||||
private function patchDependencies($extension, $dependencies) {
|
||||
// memcached 2.2.0 has no dependencies in reflection data.
|
||||
if($extension == 'memcached') {
|
||||
$dependencies = array_unique(array_merge($dependencies, array('igbinary', 'json', 'msgpack')));
|
||||
@ -90,7 +90,7 @@ class ExtensionMap {
|
||||
* @param string $extension
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function addExtensionToMap($extension) {
|
||||
private function addExtensionToMap($extension) {
|
||||
if($this->map && array_key_exists($extension, $this->map) && !empty($this->map[$extension])) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user