setup-php 2.13.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +990 -922
- package/lib/config.d.ts +3 -0
- package/lib/config.js +71 -71
- package/lib/config.js.map +1 -1
- package/lib/coverage.d.ts +5 -0
- package/lib/coverage.js +97 -87
- package/lib/coverage.js.map +1 -1
- package/lib/extensions.d.ts +4 -0
- package/lib/extensions.js +214 -200
- package/lib/extensions.js.map +1 -1
- package/lib/fetch.d.ts +1 -0
- package/lib/fetch.js +63 -0
- package/lib/fetch.js.map +1 -0
- package/lib/install.d.ts +2 -0
- package/lib/install.js +75 -81
- package/lib/install.js.map +1 -1
- package/lib/tools.d.ts +23 -0
- package/lib/tools.js +367 -386
- package/lib/tools.js.map +1 -1
- package/lib/utils.d.ts +21 -0
- package/lib/utils.js +261 -291
- package/lib/utils.js.map +1 -1
- package/package.json +67 -56
- package/src/config.ts +82 -82
- package/src/configs/brew_extensions +31 -0
- package/src/configs/composer.env +2 -0
- package/src/configs/ini/jit.ini +3 -0
- package/src/configs/ini/php.ini +2 -0
- package/src/configs/ini/xdebug.ini +1 -0
- package/src/configs/os_releases.csv +19 -17
- package/src/configs/php-versions.json +6 -5
- package/src/configs/php_packages +12 -0
- package/src/configs/{php.json → pm/php.json} +29 -29
- package/src/configs/{phpunit.json → pm/phpunit.json} +24 -24
- package/src/configs/tools.json +278 -235
- package/src/configs/tools_schema.json +125 -114
- package/src/coverage.ts +144 -142
- package/src/extensions.ts +367 -349
- package/src/fetch.ts +54 -0
- package/src/install.ts +66 -82
- package/src/scripts/darwin.sh +285 -249
- package/src/scripts/extensions/add_extensions.ps1 +194 -0
- package/src/scripts/extensions/add_extensions.sh +184 -0
- package/src/scripts/{ext → extensions}/blackfire.ps1 +32 -32
- package/src/scripts/{ext → extensions}/blackfire.sh +22 -21
- package/src/scripts/{ext → extensions}/couchbase.sh +43 -43
- package/src/scripts/{ext → extensions}/cubrid.sh +60 -60
- package/src/scripts/extensions/extension_map.php +132 -0
- package/src/scripts/{ext → extensions}/firebird.ps1 +19 -19
- package/src/scripts/{ext → extensions}/firebird.sh +39 -35
- package/src/scripts/{ext → extensions}/gearman.sh +22 -22
- package/src/scripts/{ext → extensions}/geos.sh +17 -17
- package/src/scripts/{ext → extensions}/http.ps1 +54 -54
- package/src/scripts/{ext → extensions}/http.sh +109 -120
- package/src/scripts/{ext → extensions}/intl.sh +23 -23
- package/src/scripts/{ext → extensions}/ioncube.ps1 +33 -32
- package/src/scripts/{ext → extensions}/ioncube.sh +21 -19
- package/src/scripts/{ext → extensions}/oci.ps1 +85 -60
- package/src/scripts/{ext → extensions}/oci.sh +65 -63
- package/src/scripts/{ext → extensions}/patches/firebird.sh +11 -11
- package/src/scripts/{ext → extensions}/patches/geos.sh +7 -7
- package/src/scripts/{ext → extensions}/patches/http.sh +11 -11
- package/src/scripts/{ext → extensions}/patches/pdo_oci.sh +6 -6
- package/src/scripts/{ext → extensions}/patches/phpize.sh +26 -26
- package/src/scripts/{ext → extensions}/patches/protobuf.sh +4 -4
- package/src/scripts/{ext → extensions}/phalcon.ps1 +54 -54
- package/src/scripts/{ext → extensions}/phalcon.sh +58 -58
- package/src/scripts/{ext → extensions}/source.sh +145 -144
- package/src/scripts/extensions/sqlsrv.sh +15 -0
- package/src/scripts/linux.sh +269 -256
- package/src/scripts/tools/add_tools.ps1 +239 -26
- package/src/scripts/tools/add_tools.sh +175 -20
- package/src/scripts/tools/blackfire.ps1 +19 -19
- package/src/scripts/tools/blackfire.sh +40 -39
- package/src/scripts/tools/grpc_php_plugin.ps1 +21 -21
- package/src/scripts/tools/grpc_php_plugin.sh +58 -58
- package/src/scripts/tools/ppa.sh +192 -151
- package/src/scripts/tools/protoc.ps1 +38 -38
- package/src/scripts/tools/protoc.sh +28 -28
- package/src/scripts/tools/symfony.ps1 +14 -0
- package/src/scripts/tools/symfony.sh +13 -0
- package/src/scripts/unix.sh +186 -0
- package/src/scripts/win32.ps1 +352 -494
- package/src/tools.ts +512 -538
- package/src/utils.ts +415 -500
- package/.eslintrc.json +0 -16
- package/.github/CODE_OF_CONDUCT.md +0 -76
- package/.github/CONTRIBUTING.md +0 -70
- package/.github/FUNDING.yml +0 -7
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -37
- package/.github/SECURITY.md +0 -29
- package/.github/workflows/docs.yml +0 -77
- package/.github/workflows/node-workflow.yml +0 -51
- package/.github/workflows/workflow.yml +0 -78
- package/.idea/workspace.xml +0 -113
- package/.prettierrc.json +0 -12
- package/__tests__/config.test.ts +0 -52
- package/__tests__/coverage.test.ts +0 -110
- package/__tests__/extensions.test.ts +0 -263
- package/__tests__/install.test.ts +0 -175
- package/__tests__/tools.test.ts +0 -524
- package/__tests__/utils.test.ts +0 -307
- package/action.yml +0 -29
- package/dist/index.js +0 -3051
- package/examples/bedrock.yml +0 -32
- package/examples/blackfire-player.yml +0 -31
- package/examples/blackfire.yml +0 -31
- package/examples/cakephp-mysql.yml +0 -114
- package/examples/cakephp-postgres.yml +0 -112
- package/examples/cakephp.yml +0 -92
- package/examples/codeigniter.yml +0 -34
- package/examples/laravel-mysql.yml +0 -74
- package/examples/laravel-postgres.yml +0 -74
- package/examples/laravel.yml +0 -42
- package/examples/lumen-mysql.yml +0 -74
- package/examples/lumen-postgres.yml +0 -74
- package/examples/lumen.yml +0 -38
- package/examples/phalcon-mysql.yml +0 -74
- package/examples/phalcon-postgres.yml +0 -73
- package/examples/sage.yml +0 -57
- package/examples/slim-framework.yml +0 -34
- package/examples/symfony-mysql.yml +0 -57
- package/examples/symfony-postgres.yml +0 -55
- package/examples/symfony.yml +0 -39
- package/examples/yii2-mysql.yml +0 -73
- package/examples/yii2-postgres.yml +0 -71
- package/examples/zend-framework.yml +0 -36
- package/jest.config.js +0 -12
- package/lib/sapi.js +0 -64
- package/src/scripts/common.sh +0 -314
- package/tsconfig.json +0 -18
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Function to link dependencies to PHP directory.
|
|
2
|
+
Function Set-ExtensionPrerequisites
|
|
3
|
+
{
|
|
4
|
+
Param (
|
|
5
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
6
|
+
[ValidateNotNull()]
|
|
7
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
8
|
+
[string]
|
|
9
|
+
$deps_dir
|
|
10
|
+
)
|
|
11
|
+
$deps = Get-ChildItem -Recurse -Path $deps_dir
|
|
12
|
+
if ($deps.Count -ne 0) {
|
|
13
|
+
# Symlink dependencies instead of adding the directory to PATH ...
|
|
14
|
+
# as other actions change the PATH thus breaking extensions.
|
|
15
|
+
$deps | ForEach-Object {
|
|
16
|
+
New-Item -Itemtype SymbolicLink -Path $php_dir -Name $_.Name -Target $_.FullName -Force > $null 2>&1
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
Remove-Item $deps_dir -Recurse -Force
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Function to add PHP extensions.
|
|
24
|
+
Function Add-Extension {
|
|
25
|
+
Param (
|
|
26
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
27
|
+
[ValidateNotNull()]
|
|
28
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
29
|
+
[string]
|
|
30
|
+
$extension,
|
|
31
|
+
[Parameter(Position = 1, Mandatory = $false)]
|
|
32
|
+
[ValidateNotNull()]
|
|
33
|
+
[ValidateSet('stable', 'beta', 'alpha', 'devel', 'snapshot')]
|
|
34
|
+
[string]
|
|
35
|
+
$stability = 'stable',
|
|
36
|
+
[Parameter(Position = 2, Mandatory = $false)]
|
|
37
|
+
[ValidateNotNull()]
|
|
38
|
+
[ValidatePattern('^\d+(\.\d+){0,2}$')]
|
|
39
|
+
[string]
|
|
40
|
+
$extension_version = ''
|
|
41
|
+
)
|
|
42
|
+
try {
|
|
43
|
+
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
|
|
44
|
+
$deps_dir = "$ext_dir\$extension-vc$($installed.VCVersion)-$arch"
|
|
45
|
+
New-Item $deps_dir -Type Directory -Force > $null 2>&1
|
|
46
|
+
if ($null -ne $extension_info) {
|
|
47
|
+
switch ($extension_info.State) {
|
|
48
|
+
'Builtin' {
|
|
49
|
+
Add-Log $tick $extension "Enabled"
|
|
50
|
+
}
|
|
51
|
+
'Enabled' {
|
|
52
|
+
Add-Log $tick $extension "Enabled"
|
|
53
|
+
}
|
|
54
|
+
default {
|
|
55
|
+
Enable-ExtensionDependencies $extension
|
|
56
|
+
Enable-PhpExtension -Extension $extension_info.Handle -Path $php_dir
|
|
57
|
+
Set-ExtensionPrerequisites $deps_dir
|
|
58
|
+
Add-Log $tick $extension "Enabled"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
# Patch till PHP 8.1 DLLs are released as stable.
|
|
64
|
+
$minimumStability = $stability
|
|
65
|
+
if($version -eq '8.1' -and $stability -eq 'stable') {
|
|
66
|
+
$minimumStability = 'snapshot'
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
$params = @{ Extension = $extension; MinimumStability = $minimumStability; MaximumStability = $stability; Path = $php_dir; AdditionalFilesPath = $deps_dir; NoDependencies = $true }
|
|
70
|
+
if($extension_version -ne '') {
|
|
71
|
+
$params["Version"] = $extension_version
|
|
72
|
+
}
|
|
73
|
+
Install-PhpExtension @params
|
|
74
|
+
Set-ExtensionPrerequisites $deps_dir
|
|
75
|
+
Add-Log $tick $extension "Installed and enabled"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Function to get a map of extensions and their dependent shared extensions.
|
|
84
|
+
Function Get-ExtensionMap {
|
|
85
|
+
php -d'error_reporting=0' $src\scripts\extensions\extension_map.php $env:TEMP\map$version.orig
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# Function to enable extension dependencies which are also extensions.
|
|
89
|
+
Function Enable-ExtensionDependencies {
|
|
90
|
+
Param (
|
|
91
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
92
|
+
[ValidateNotNull()]
|
|
93
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
94
|
+
[string]
|
|
95
|
+
$extension
|
|
96
|
+
)
|
|
97
|
+
if (-not(Test-Path $env:TEMP\extdisabled\$extension)) {
|
|
98
|
+
return
|
|
99
|
+
}
|
|
100
|
+
Get-ExtensionMap
|
|
101
|
+
$entry = findstr /r "$extension`:.*" $env:TEMP\map$version.orig
|
|
102
|
+
if($entry) {
|
|
103
|
+
$entry.split(':')[1].trim().split(' ') | ForEach-Object {
|
|
104
|
+
if (-not(php -m | findstr -i $_)) {
|
|
105
|
+
Enable-PhpExtension -Extension $_ -Path $php_dir
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
Remove-Item $env:TEMP\extdisabled\$extension -Force
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# Function to disable dependent extensions.
|
|
113
|
+
Function Disable-DependentExtensions() {
|
|
114
|
+
Param (
|
|
115
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
116
|
+
[ValidateNotNull()]
|
|
117
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
118
|
+
[string]
|
|
119
|
+
$extension
|
|
120
|
+
)
|
|
121
|
+
Select-String -Pattern ".*:.*\s$extension(\s|$)" $env:TEMP\map$version.orig | ForEach-Object {
|
|
122
|
+
$dependent = $_.Matches[0].Value.split(':')[0];
|
|
123
|
+
Disable-ExtensionHelper -Extension $dependent -DisableDependents
|
|
124
|
+
Add-Log $tick ":$extension" "Disabled $dependent as it depends on $extension"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
# Helper function to disable an extension.
|
|
129
|
+
Function Disable-ExtensionHelper() {
|
|
130
|
+
Param (
|
|
131
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
132
|
+
[ValidateNotNull()]
|
|
133
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
134
|
+
[string]
|
|
135
|
+
$extension,
|
|
136
|
+
[switch] $DisableDependents
|
|
137
|
+
)
|
|
138
|
+
Get-ExtensionMap
|
|
139
|
+
if($DisableDependents) {
|
|
140
|
+
Disable-DependentExtensions $extension
|
|
141
|
+
}
|
|
142
|
+
Disable-PhpExtension -Extension $extension -Path $php_dir
|
|
143
|
+
New-Item $env:TEMP\extdisabled -Type Directory -Force > $null 2>&1
|
|
144
|
+
New-Item $env:TEMP\extdisabled\$extension -Type File -Force > $null 2>&1
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
# Function to disable an extension.
|
|
148
|
+
Function Disable-Extension() {
|
|
149
|
+
Param (
|
|
150
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
151
|
+
[ValidateNotNull()]
|
|
152
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
153
|
+
[string]
|
|
154
|
+
$extension,
|
|
155
|
+
[Parameter(Position = 1, Mandatory = $false)]
|
|
156
|
+
[ValidateNotNull()]
|
|
157
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
158
|
+
[string]
|
|
159
|
+
$DisableDependents
|
|
160
|
+
)
|
|
161
|
+
if(php -m | findstr -i $extension) {
|
|
162
|
+
if(Test-Path $ext_dir\php_$extension.dll) {
|
|
163
|
+
try {
|
|
164
|
+
$params = @{ Extension = $extension; DisableDependents = ($DisableDependents -ne 'false') }
|
|
165
|
+
Disable-ExtensionHelper @params
|
|
166
|
+
Add-Log $tick ":$extension" "Disabled"
|
|
167
|
+
} catch {
|
|
168
|
+
Add-Log $cross ":$extension" "Could not disable $extension on PHP $($installed.FullVersion)"
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
Add-Log $cross ":$extension" "Could not disable $extension on PHP $($installed.FullVersion) as it not a shared extension"
|
|
172
|
+
}
|
|
173
|
+
} elseif(Test-Path $ext_dir\php_$extension.dll) {
|
|
174
|
+
Add-Log $tick ":$extension" "Disabled"
|
|
175
|
+
} else {
|
|
176
|
+
Add-Log $tick ":$extension" "Could not find $extension on PHP $($installed.FullVersion)"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
# Function to disable shared extensions.
|
|
181
|
+
Function Disable-AllShared() {
|
|
182
|
+
Get-ExtensionMap
|
|
183
|
+
(Get-Content $php_dir\php.ini) | Where-Object {$_ -notmatch '^(zend_)?extension\s*='} | Set-Content $php_dir\php.ini
|
|
184
|
+
New-Item $env:TEMP\extdisabled\$version -Type Directory -Force > $null 2>&1
|
|
185
|
+
Get-Childitem $ext_dir\*.dll | ForEach-Object {
|
|
186
|
+
New-Item ("$env:TEMP\extdisabled\$version\" + ($_.Name.split('.')[0].split('_')[1])) -Type File -Force > $null 2>&1
|
|
187
|
+
}
|
|
188
|
+
Add-Log $tick "none" "Disabled all shared extensions"
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
# Function to handle request to add PECL.
|
|
192
|
+
Function Add-Pecl() {
|
|
193
|
+
Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows"
|
|
194
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Function to log result of installing extension.
|
|
2
|
+
add_extension_log() {
|
|
3
|
+
(
|
|
4
|
+
check_extension "$(echo "$1" | cut -d '-' -f 1)" && add_log "${tick:?}" "$1" "$2"
|
|
5
|
+
) || add_log "${cross:?}" "$1" "Could not install $1 on PHP ${semver:?}"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
# Function to test if extension is loaded.
|
|
9
|
+
check_extension() {
|
|
10
|
+
local extension=$1
|
|
11
|
+
if [ "$extension" != "mysql" ]; then
|
|
12
|
+
php -m | grep -i -q -w "$extension"
|
|
13
|
+
else
|
|
14
|
+
php -m | grep -i -q "$extension"
|
|
15
|
+
fi
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
# Function to check if extension is shared
|
|
19
|
+
shared_extension() {
|
|
20
|
+
[ -e "${ext_dir:?}/$1.so" ]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Function to enable cached extension's dependencies.
|
|
24
|
+
enable_cache_extension_dependencies() {
|
|
25
|
+
if [ -d /tmp/extcache ] && shared_extension "$1"; then
|
|
26
|
+
cache_dir=$(find /tmp/extcache -maxdepth 1 -type d -regex ".*$1[0-9]*")
|
|
27
|
+
if [[ -n "$cache_dir" ]]; then
|
|
28
|
+
IFS=" " read -r -a deps <<<"$(find "$cache_dir" -maxdepth 1 -type f -name "*" -exec basename {} \; | tr '\n' ' ')"
|
|
29
|
+
if [[ -n "${deps[*]}" ]] && php "${deps[@]/#/-d ${2}=}" -d "${2}=$1" -m 2>/dev/null | grep -i -q "$1"; then
|
|
30
|
+
for ext in "${deps[@]}"; do
|
|
31
|
+
sudo rm -rf /tmp/extcache/"$ext"
|
|
32
|
+
enable_extension "$ext" "$2"
|
|
33
|
+
done
|
|
34
|
+
fi
|
|
35
|
+
fi
|
|
36
|
+
fi
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Function to enable existing extensions.
|
|
40
|
+
enable_extension() {
|
|
41
|
+
modules_dir="/var/lib/php/modules/${version:?}"
|
|
42
|
+
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
|
|
43
|
+
enable_extension_dependencies "$1" "$2"
|
|
44
|
+
enable_cache_extension_dependencies "$1" "$2"
|
|
45
|
+
if ! check_extension "$1" && shared_extension "$1"; then
|
|
46
|
+
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
|
47
|
+
fi
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# Function to enable array of extensions
|
|
51
|
+
enable_extensions() {
|
|
52
|
+
local extensions=("$@")
|
|
53
|
+
to_wait=()
|
|
54
|
+
for ext in "${extensions[@]}"; do
|
|
55
|
+
enable_extension "$ext" extension >/dev/null 2>&1 &
|
|
56
|
+
to_wait+=($!)
|
|
57
|
+
done
|
|
58
|
+
wait "${to_wait[@]}"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# Function to get a map of extensions and their dependent shared extensions.
|
|
62
|
+
get_extension_map() {
|
|
63
|
+
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# Function to enable extension dependencies which are also extensions.
|
|
67
|
+
enable_extension_dependencies() {
|
|
68
|
+
local extension=$1
|
|
69
|
+
local prefix=$2
|
|
70
|
+
[ -e /tmp/extdisabled/"$version"/"$extension" ] || return;
|
|
71
|
+
get_extension_map
|
|
72
|
+
for dependency in $(grep "$extension:" /tmp/map"$version".orig | cut -d ':' -f 2 | tr '\n' ' '); do
|
|
73
|
+
enable_extension "$dependency" "$prefix"
|
|
74
|
+
done
|
|
75
|
+
rm /tmp/extdisabled/"$version"/"$extension"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# Function to disable dependent extensions.
|
|
79
|
+
disable_extension_dependents() {
|
|
80
|
+
local extension=$1
|
|
81
|
+
for dependent in $(grep -E ".*:.*\s$extension(\s|$)" /tmp/map"$version".orig | cut -d ':' -f 1 | tr '\n' ' '); do
|
|
82
|
+
disable_extension_helper "$dependent" true
|
|
83
|
+
add_log "${tick:?}" ":$extension" "Disabled $dependent as it depends on $extension"
|
|
84
|
+
done
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
# Function to disable an extension.
|
|
88
|
+
disable_extension() {
|
|
89
|
+
local extension=$1
|
|
90
|
+
if check_extension "$extension"; then
|
|
91
|
+
if shared_extension "$extension"; then
|
|
92
|
+
disable_extension_helper "$extension" true
|
|
93
|
+
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Disabled") ||
|
|
94
|
+
add_log "${cross:?}" ":$extension" "Could not disable $extension on PHP ${semver:?}"
|
|
95
|
+
else
|
|
96
|
+
add_log "${cross:?}" ":$extension" "Could not disable $extension on PHP $semver as it not a shared extension"
|
|
97
|
+
fi
|
|
98
|
+
elif shared_extension "$extension"; then
|
|
99
|
+
add_log "${tick:?}" ":$extension" "Disabled"
|
|
100
|
+
else
|
|
101
|
+
add_log "${tick:?}" ":$extension" "Could not find $extension on PHP $semver"
|
|
102
|
+
fi
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
# Function to disable shared extensions.
|
|
106
|
+
disable_all_shared() {
|
|
107
|
+
get_extension_map
|
|
108
|
+
sudo sed -i.orig -E -e "/^(zend_)?extension\s*=/d" "${ini_file[@]}" "$pecl_file" 2>/dev/null || true
|
|
109
|
+
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
|
|
110
|
+
mkdir -p /tmp/extdisabled/"$version"
|
|
111
|
+
sudo find "$ext_dir" -name '*.so' -print0 | xargs -0 -n 1 basename -s .so | xargs -n 1 -I{} touch /tmp/extdisabled/"$version"/{}
|
|
112
|
+
add_log "${tick:?}" "none" "Disabled all shared extensions"
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# Function to configure PECL.
|
|
116
|
+
configure_pecl() {
|
|
117
|
+
if ! [ -e /tmp/pecl_config ]; then
|
|
118
|
+
for script in pear pecl; do
|
|
119
|
+
sudo "$script" config-set php_ini "${pecl_file:-${ini_file[@]}}"
|
|
120
|
+
sudo "$script" channel-update "$script".php.net
|
|
121
|
+
done
|
|
122
|
+
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
|
|
123
|
+
fi
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
# Function to add an extension.
|
|
127
|
+
add_extension() {
|
|
128
|
+
local extension=$1
|
|
129
|
+
local prefix=$2
|
|
130
|
+
enable_extension "$extension" "$prefix"
|
|
131
|
+
if check_extension "$extension"; then
|
|
132
|
+
add_log "${tick:?}" "$extension" "Enabled"
|
|
133
|
+
else
|
|
134
|
+
add_extension_helper "$extension" "$prefix"
|
|
135
|
+
fi
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
# Function to get the PECL version of an extension.
|
|
139
|
+
get_pecl_version() {
|
|
140
|
+
local extension=$1
|
|
141
|
+
stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")"
|
|
142
|
+
pecl_rest='https://pecl.php.net/rest/r/'
|
|
143
|
+
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
|
|
144
|
+
pecl_version=$(echo "$response" | grep -m 1 -Eio "([0-9]+\.[0-9]+\.[0-9]+${stability}[0-9]+)")
|
|
145
|
+
if [ ! "$pecl_version" ]; then
|
|
146
|
+
pecl_version=$(echo "$response" | grep -m 1 -Eo "([0-9]+\.[0-9]+\.[0-9]+)")
|
|
147
|
+
fi
|
|
148
|
+
echo "$pecl_version"
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
# Function to install PECL extensions and accept default options
|
|
152
|
+
pecl_install() {
|
|
153
|
+
local extension=$1
|
|
154
|
+
add_pecl >/dev/null 2>&1
|
|
155
|
+
yes '' 2>/dev/null | sudo pecl install -f "$extension" >/dev/null 2>&1
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
# Function to install a specific version of PECL extension.
|
|
159
|
+
add_pecl_extension() {
|
|
160
|
+
local extension=$1
|
|
161
|
+
local pecl_version=$2
|
|
162
|
+
local prefix=$3
|
|
163
|
+
enable_extension "$extension" "$prefix"
|
|
164
|
+
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
|
165
|
+
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
|
166
|
+
fi
|
|
167
|
+
ext_version=$(php -r "echo phpversion('$extension');")
|
|
168
|
+
if [ "${ext_version/-/}" = "$pecl_version" ]; then
|
|
169
|
+
add_log "${tick:?}" "$extension" "Enabled"
|
|
170
|
+
else
|
|
171
|
+
disable_extension_helper "$extension" >/dev/null 2>&1
|
|
172
|
+
pecl_install "$extension-$pecl_version"
|
|
173
|
+
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
|
174
|
+
fi
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
# Function to setup pre-release extensions using PECL.
|
|
178
|
+
add_unstable_extension() {
|
|
179
|
+
local extension=$1
|
|
180
|
+
local stability=$2
|
|
181
|
+
local prefix=$3
|
|
182
|
+
pecl_version=$(get_pecl_version "$extension" "$stability")
|
|
183
|
+
add_pecl_extension "$extension" "$pecl_version" "$prefix"
|
|
184
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
# Function to install blackfire extension.
|
|
2
|
-
Function Add-Blackfire() {
|
|
3
|
-
Param (
|
|
4
|
-
[Parameter(Position = 0, Mandatory = $true)]
|
|
5
|
-
[ValidateNotNull()]
|
|
6
|
-
[string]
|
|
7
|
-
$extension
|
|
8
|
-
)
|
|
9
|
-
try {
|
|
10
|
-
$no_dot_version = $version.replace('.', '')
|
|
11
|
-
$extension_version = $extension.split('-')[1]
|
|
12
|
-
if ($extension_version -notmatch "\S") {
|
|
13
|
-
if($version -lt '7.0') {
|
|
14
|
-
$extension_version = '1.50.0'
|
|
15
|
-
} else {
|
|
16
|
-
$extension_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).probe.php
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
if (Test-Path $ext_dir\blackfire.dll) {
|
|
20
|
-
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
|
21
|
-
$status="Enabled"
|
|
22
|
-
} else {
|
|
23
|
-
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
|
24
|
-
Invoke-WebRequest -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
|
25
|
-
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
|
26
|
-
$status="Installed and enabled"
|
|
27
|
-
}
|
|
28
|
-
Add-Log $tick $extension $status
|
|
29
|
-
} catch {
|
|
30
|
-
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
# Function to install blackfire extension.
|
|
2
|
+
Function Add-Blackfire() {
|
|
3
|
+
Param (
|
|
4
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
5
|
+
[ValidateNotNull()]
|
|
6
|
+
[string]
|
|
7
|
+
$extension
|
|
8
|
+
)
|
|
9
|
+
try {
|
|
10
|
+
$no_dot_version = $version.replace('.', '')
|
|
11
|
+
$extension_version = $extension.split('-')[1]
|
|
12
|
+
if ($extension_version -notmatch "\S") {
|
|
13
|
+
if($version -lt '7.0') {
|
|
14
|
+
$extension_version = '1.50.0'
|
|
15
|
+
} else {
|
|
16
|
+
$extension_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).probe.php
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (Test-Path $ext_dir\blackfire.dll) {
|
|
20
|
+
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
|
21
|
+
$status="Enabled"
|
|
22
|
+
} else {
|
|
23
|
+
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
|
24
|
+
Invoke-WebRequest -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
|
25
|
+
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
|
26
|
+
$status="Installed and enabled"
|
|
27
|
+
}
|
|
28
|
+
Add-Log $tick $extension $status
|
|
29
|
+
} catch {
|
|
30
|
+
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
# Function to install blackfire extension.
|
|
2
|
-
add_blackfire() {
|
|
3
|
-
extension=$1
|
|
4
|
-
version=${version:?}
|
|
5
|
-
no_dot_version=${version/./}
|
|
6
|
-
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
7
|
-
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
|
8
|
-
|
|
9
|
-
if
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
# Function to install blackfire extension.
|
|
2
|
+
add_blackfire() {
|
|
3
|
+
local extension=$1
|
|
4
|
+
version=${version:?}
|
|
5
|
+
no_dot_version=${version/./}
|
|
6
|
+
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
7
|
+
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
|
8
|
+
status='Enabled'
|
|
9
|
+
if ! shared_extension blackfire; then
|
|
10
|
+
status='Installed and enabled'
|
|
11
|
+
if [ "$extension_version" = "blackfire" ]; then
|
|
12
|
+
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
|
13
|
+
extension_version='1.50.0'
|
|
14
|
+
else
|
|
15
|
+
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
|
16
|
+
fi
|
|
17
|
+
fi
|
|
18
|
+
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_amd64-php-"$no_dot_version".so >/dev/null 2>&1
|
|
19
|
+
fi
|
|
20
|
+
enable_extension blackfire extension
|
|
21
|
+
add_extension_log blackfire "$status"
|
|
22
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
# Function to install libraries required by couchbase
|
|
2
|
-
add_couchbase_libs() {
|
|
3
|
-
if [ "$(uname -s)" = "Linux" ]; then
|
|
4
|
-
trunk="https://github.com/couchbase/libcouchbase/releases"
|
|
5
|
-
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
|
6
|
-
release="2.10.9"
|
|
7
|
-
else
|
|
8
|
-
release="$(curl -sL $trunk/latest | grep -Eo "libcouchbase-[0-9]+\.[0-9]+\.[0-9]+" | head -n 1 | cut -d'-' -f 2)"
|
|
9
|
-
fi
|
|
10
|
-
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu${VERSION_ID/./}_${VERSION_CODENAME}_amd64.tar"
|
|
11
|
-
get -q -n /tmp/libcouchbase.tar "$deb_url"
|
|
12
|
-
sudo tar -xf /tmp/libcouchbase.tar -C /tmp
|
|
13
|
-
install_packages libev4 libevent-dev
|
|
14
|
-
sudo dpkg -i /tmp/libcouchbase-*/*.deb
|
|
15
|
-
else
|
|
16
|
-
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
|
17
|
-
brew install libcouchbase@2
|
|
18
|
-
brew link --overwrite --force libcouchbase@2
|
|
19
|
-
else
|
|
20
|
-
brew install libcouchbase
|
|
21
|
-
fi
|
|
22
|
-
fi
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
# Function to add couchbase.
|
|
26
|
-
add_couchbase() {
|
|
27
|
-
add_couchbase_libs >/dev/null 2>&1
|
|
28
|
-
enable_extension "couchbase" "extension"
|
|
29
|
-
if check_extension "couchbase"; then
|
|
30
|
-
add_log "${tick:?}" "couchbase" "Enabled"
|
|
31
|
-
else
|
|
32
|
-
if [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
|
33
|
-
pecl_install couchbase-2.2.3 >/dev/null 2>&1
|
|
34
|
-
elif [[ "${version:?}" =~ 5.6|7.[0-1] ]]; then
|
|
35
|
-
pecl_install couchbase-2.6.2 >/dev/null 2>&1
|
|
36
|
-
elif [[ "${version:?}" =~ 7.2 ]]; then
|
|
37
|
-
pecl_install couchbase-3.0.4 >/dev/null 2>&1
|
|
38
|
-
else
|
|
39
|
-
pecl_install couchbase >/dev/null 2>&1
|
|
40
|
-
fi
|
|
41
|
-
add_extension_log "couchbase" "Installed and enabled"
|
|
42
|
-
fi
|
|
43
|
-
}
|
|
1
|
+
# Function to install libraries required by couchbase
|
|
2
|
+
add_couchbase_libs() {
|
|
3
|
+
if [ "$(uname -s)" = "Linux" ]; then
|
|
4
|
+
trunk="https://github.com/couchbase/libcouchbase/releases"
|
|
5
|
+
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
|
6
|
+
release="2.10.9"
|
|
7
|
+
else
|
|
8
|
+
release="$(curl -sL $trunk/latest | grep -Eo "libcouchbase-[0-9]+\.[0-9]+\.[0-9]+" | head -n 1 | cut -d'-' -f 2)"
|
|
9
|
+
fi
|
|
10
|
+
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu${VERSION_ID/./}_${VERSION_CODENAME}_amd64.tar"
|
|
11
|
+
get -q -n /tmp/libcouchbase.tar "$deb_url"
|
|
12
|
+
sudo tar -xf /tmp/libcouchbase.tar -C /tmp
|
|
13
|
+
install_packages libev4 libevent-dev
|
|
14
|
+
sudo dpkg -i /tmp/libcouchbase-*/*.deb
|
|
15
|
+
else
|
|
16
|
+
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
|
17
|
+
brew install libcouchbase@2
|
|
18
|
+
brew link --overwrite --force libcouchbase@2
|
|
19
|
+
else
|
|
20
|
+
brew install libcouchbase
|
|
21
|
+
fi
|
|
22
|
+
fi
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
# Function to add couchbase.
|
|
26
|
+
add_couchbase() {
|
|
27
|
+
add_couchbase_libs >/dev/null 2>&1
|
|
28
|
+
enable_extension "couchbase" "extension"
|
|
29
|
+
if check_extension "couchbase"; then
|
|
30
|
+
add_log "${tick:?}" "couchbase" "Enabled"
|
|
31
|
+
else
|
|
32
|
+
if [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
|
33
|
+
pecl_install couchbase-2.2.3 >/dev/null 2>&1
|
|
34
|
+
elif [[ "${version:?}" =~ 5.6|7.[0-1] ]]; then
|
|
35
|
+
pecl_install couchbase-2.6.2 >/dev/null 2>&1
|
|
36
|
+
elif [[ "${version:?}" =~ 7.2 ]]; then
|
|
37
|
+
pecl_install couchbase-3.0.4 >/dev/null 2>&1
|
|
38
|
+
else
|
|
39
|
+
pecl_install couchbase >/dev/null 2>&1
|
|
40
|
+
fi
|
|
41
|
+
add_extension_log "couchbase" "Installed and enabled"
|
|
42
|
+
fi
|
|
43
|
+
}
|