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 to get a map of extensions and their dependent shared extensions.
|
||||||
Function Get-ExtensionMap {
|
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.
|
# Function to enable extension dependencies which are also extensions.
|
||||||
@ -98,7 +98,7 @@ Function Enable-ExtensionDependencies {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
Get-ExtensionMap
|
Get-ExtensionMap
|
||||||
$entry = findstr /r "$extension`:.*" $env:TEMP\map.orig
|
$entry = findstr /r "$extension`:.*" $env:TEMP\map$version.orig
|
||||||
if($entry) {
|
if($entry) {
|
||||||
$entry.split(':')[1].trim().split(' ') | ForEach-Object {
|
$entry.split(':')[1].trim().split(' ') | ForEach-Object {
|
||||||
if (-not(php -m | findstr -i $_)) {
|
if (-not(php -m | findstr -i $_)) {
|
||||||
@ -118,7 +118,7 @@ Function Disable-DependentExtensions() {
|
|||||||
[string]
|
[string]
|
||||||
$extension
|
$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];
|
$dependent = $_.Matches[0].Value.split(':')[0];
|
||||||
Disable-ExtensionHelper -Extension $dependent -DisableDependents
|
Disable-ExtensionHelper -Extension $dependent -DisableDependents
|
||||||
Add-Log $tick ":$extension" "Disabled $dependent as it depends on $extension"
|
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.
|
# Function to get a map of extensions and their dependent shared extensions.
|
||||||
get_extension_map() {
|
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.
|
# Function to enable extension dependencies which are also extensions.
|
||||||
@ -58,7 +58,7 @@ enable_extension_dependencies() {
|
|||||||
prefix=$2
|
prefix=$2
|
||||||
[ -e /tmp/extdisabled/"$version"/"$extension" ] || return;
|
[ -e /tmp/extdisabled/"$version"/"$extension" ] || return;
|
||||||
get_extension_map
|
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"
|
enable_extension "$dependency" "$prefix"
|
||||||
done
|
done
|
||||||
rm /tmp/extdisabled/"$version"/"$extension"
|
rm /tmp/extdisabled/"$version"/"$extension"
|
||||||
@ -67,7 +67,7 @@ enable_extension_dependencies() {
|
|||||||
# Function to disable dependent extensions.
|
# Function to disable dependent extensions.
|
||||||
disable_extension_dependents() {
|
disable_extension_dependents() {
|
||||||
local extension=$1
|
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
|
disable_extension_helper "$dependent" true
|
||||||
add_log "${tick:?}" ":$extension" "Disabled $dependent as it depends on $extension"
|
add_log "${tick:?}" ":$extension" "Disabled $dependent as it depends on $extension"
|
||||||
done
|
done
|
||||||
|
@ -31,7 +31,7 @@ class ExtensionMap {
|
|||||||
/**
|
/**
|
||||||
* Function to read the extension map.
|
* Function to read the extension map.
|
||||||
*/
|
*/
|
||||||
public function parseMap($path) {
|
private function parseMap($path) {
|
||||||
if(file_exists($path)) {
|
if(file_exists($path)) {
|
||||||
$handle = fopen($path, "r");
|
$handle = fopen($path, "r");
|
||||||
if ($handle) {
|
if ($handle) {
|
||||||
@ -50,7 +50,7 @@ class ExtensionMap {
|
|||||||
* @param string $extension
|
* @param string $extension
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function checkSharedExtension($extension) {
|
private function checkSharedExtension($extension) {
|
||||||
$extension_file = $this->extension_dir. DIRECTORY_SEPARATOR . $this->file_prefix . $extension . $this->file_extension;
|
$extension_file = $this->extension_dir. DIRECTORY_SEPARATOR . $this->file_prefix . $extension . $this->file_extension;
|
||||||
return file_exists($extension_file);
|
return file_exists($extension_file);
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ class ExtensionMap {
|
|||||||
*
|
*
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getSharedExtensions() {
|
private function getSharedExtensions() {
|
||||||
$files = scandir($this->extension_dir);
|
$files = scandir($this->extension_dir);
|
||||||
$extensions = array_diff($files, array('.','..'));
|
$extensions = array_diff($files, array('.','..'));
|
||||||
$filter_pattern = "/$this->file_extension|$this->file_prefix/";
|
$filter_pattern = "/$this->file_extension|$this->file_prefix/";
|
||||||
@ -76,7 +76,7 @@ class ExtensionMap {
|
|||||||
* @param array $dependencies
|
* @param array $dependencies
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function patchDependencies($extension, $dependencies) {
|
private function patchDependencies($extension, $dependencies) {
|
||||||
// memcached 2.2.0 has no dependencies in reflection data.
|
// memcached 2.2.0 has no dependencies in reflection data.
|
||||||
if($extension == 'memcached') {
|
if($extension == 'memcached') {
|
||||||
$dependencies = array_unique(array_merge($dependencies, array('igbinary', 'json', 'msgpack')));
|
$dependencies = array_unique(array_merge($dependencies, array('igbinary', 'json', 'msgpack')));
|
||||||
@ -90,7 +90,7 @@ class ExtensionMap {
|
|||||||
* @param string $extension
|
* @param string $extension
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public function addExtensionToMap($extension) {
|
private function addExtensionToMap($extension) {
|
||||||
if($this->map && array_key_exists($extension, $this->map) && !empty($this->map[$extension])) {
|
if($this->map && array_key_exists($extension, $this->map) && !empty($this->map[$extension])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user