setup-php 2.16.0 → 2.18.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.
Files changed (81) hide show
  1. package/README.md +159 -141
  2. package/lib/config.d.ts +3 -0
  3. package/lib/config.js +76 -0
  4. package/lib/config.js.map +1 -0
  5. package/lib/coverage.d.ts +5 -0
  6. package/lib/coverage.js +102 -0
  7. package/lib/coverage.js.map +1 -0
  8. package/lib/extensions.d.ts +4 -0
  9. package/lib/extensions.js +219 -0
  10. package/lib/extensions.js.map +1 -0
  11. package/lib/fetch.d.ts +1 -0
  12. package/lib/fetch.js +67 -0
  13. package/lib/fetch.js.map +1 -0
  14. package/lib/install.d.ts +2 -0
  15. package/lib/install.js +80 -0
  16. package/lib/install.js.map +1 -0
  17. package/lib/tools.d.ts +23 -0
  18. package/lib/tools.js +378 -0
  19. package/lib/tools.js.map +1 -0
  20. package/lib/utils.d.ts +21 -0
  21. package/lib/utils.js +266 -0
  22. package/lib/utils.js.map +1 -0
  23. package/package.json +21 -20
  24. package/src/config.ts +8 -8
  25. package/src/configs/brew_extensions +1 -0
  26. package/src/configs/composer.env +2 -0
  27. package/src/configs/ini/jit.ini +3 -0
  28. package/src/configs/ini/php.ini +2 -0
  29. package/src/configs/ini/xdebug.ini +1 -0
  30. package/src/configs/os_releases.csv +2 -0
  31. package/src/configs/php_packages +12 -0
  32. package/src/configs/tools.json +48 -26
  33. package/src/configs/tools_schema.json +11 -0
  34. package/src/coverage.ts +24 -49
  35. package/src/extensions.ts +28 -24
  36. package/src/fetch.ts +54 -0
  37. package/src/install.ts +28 -41
  38. package/src/scripts/darwin.sh +81 -33
  39. package/src/scripts/extensions/add_extensions.ps1 +194 -0
  40. package/src/scripts/extensions/add_extensions.sh +198 -0
  41. package/src/scripts/{ext → extensions}/blackfire.ps1 +0 -0
  42. package/src/scripts/{ext → extensions}/blackfire.sh +0 -0
  43. package/src/scripts/{ext → extensions}/couchbase.sh +0 -0
  44. package/src/scripts/{ext → extensions}/cubrid.sh +3 -3
  45. package/src/scripts/{ext → extensions}/extension_map.php +36 -13
  46. package/src/scripts/{ext → extensions}/firebird.ps1 +0 -0
  47. package/src/scripts/{ext → extensions}/firebird.sh +0 -0
  48. package/src/scripts/{ext → extensions}/gearman.sh +0 -0
  49. package/src/scripts/{ext → extensions}/geos.sh +0 -0
  50. package/src/scripts/{ext → extensions}/http.ps1 +1 -0
  51. package/src/scripts/{ext → extensions}/http.sh +13 -20
  52. package/src/scripts/{ext → extensions}/intl.sh +0 -0
  53. package/src/scripts/{ext → extensions}/ioncube.ps1 +2 -2
  54. package/src/scripts/{ext → extensions}/ioncube.sh +2 -2
  55. package/src/scripts/{ext → extensions}/oci.ps1 +39 -14
  56. package/src/scripts/{ext → extensions}/oci.sh +3 -3
  57. package/src/scripts/{ext → extensions}/patches/firebird.sh +0 -0
  58. package/src/scripts/{ext → extensions}/patches/geos.sh +0 -0
  59. package/src/scripts/{ext → extensions}/patches/http.sh +0 -0
  60. package/src/scripts/{ext → extensions}/patches/pdo_oci.sh +0 -0
  61. package/src/scripts/{ext → extensions}/patches/phpize.sh +0 -0
  62. package/src/scripts/{ext → extensions}/patches/protobuf.sh +0 -0
  63. package/src/scripts/{ext → extensions}/phalcon.ps1 +0 -0
  64. package/src/scripts/{ext → extensions}/phalcon.sh +4 -5
  65. package/src/scripts/{ext → extensions}/source.sh +36 -22
  66. package/src/scripts/extensions/sqlsrv.sh +15 -0
  67. package/src/scripts/linux.sh +76 -36
  68. package/src/scripts/tools/add_tools.ps1 +220 -10
  69. package/src/scripts/tools/add_tools.sh +164 -17
  70. package/src/scripts/tools/grpc_php_plugin.ps1 +4 -4
  71. package/src/scripts/tools/grpc_php_plugin.sh +3 -3
  72. package/src/scripts/tools/ppa.sh +12 -9
  73. package/src/scripts/tools/protoc.ps1 +2 -2
  74. package/src/scripts/tools/protoc.sh +2 -2
  75. package/src/scripts/tools/symfony.ps1 +18 -0
  76. package/src/scripts/tools/symfony.sh +18 -0
  77. package/src/scripts/unix.sh +186 -0
  78. package/src/scripts/win32.ps1 +137 -336
  79. package/src/tools.ts +62 -82
  80. package/src/utils.ts +57 -145
  81. package/src/scripts/common.sh +0 -366
@@ -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,198 @@
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
+ local extension_list=/tmp/php${version:?}_extensions
12
+ if [ ! -e "$extension_list" ]; then
13
+ php -m > "$extension_list"
14
+ fi
15
+ if [ "$extension" != "mysql" ]; then
16
+ grep -i -q -w "$extension" "$extension_list" || php -m | grep -i -q -w "$extension"
17
+ else
18
+ grep -i -q "$extension" "$extension_list" || php -m | grep -i -q "$extension"
19
+ fi
20
+ }
21
+
22
+ # Function to check if extension is shared
23
+ shared_extension() {
24
+ [ -e "${ext_dir:?}/$1.so" ]
25
+ }
26
+
27
+ # Function to enable cached extension's dependencies.
28
+ enable_cache_extension_dependencies() {
29
+ if [ -d /tmp/extcache ] && shared_extension "$1"; then
30
+ cache_dir=$(find /tmp/extcache -maxdepth 1 -type d -regex ".*$1[0-9]*")
31
+ if [[ -n "$cache_dir" ]]; then
32
+ IFS=" " read -r -a deps <<<"$(find "$cache_dir" -maxdepth 1 -type f -name "*" -exec basename {} \; | tr '\n' ' ')"
33
+ if [[ -n "${deps[*]}" ]] && php "${deps[@]/#/-d ${2}=}" -d "${2}=$1" -m 2>/dev/null | grep -i -q "$1"; then
34
+ for ext in "${deps[@]}"; do
35
+ sudo rm -rf /tmp/extcache/"$ext"
36
+ enable_extension "$ext" "$2"
37
+ done
38
+ fi
39
+ fi
40
+ fi
41
+ }
42
+
43
+ # Function to enable existing extensions.
44
+ enable_extension() {
45
+ if ! check_extension "$1" && shared_extension "$1"; then
46
+ modules_dir="/var/lib/php/modules/${version:?}"
47
+ [ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
48
+ enable_extension_dependencies "$1" "$2"
49
+ enable_cache_extension_dependencies "$1" "$2"
50
+ echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
51
+ fi
52
+ }
53
+
54
+ # Function to enable array of extensions
55
+ enable_extensions() {
56
+ local extensions=("$@")
57
+ to_wait=()
58
+ for ext in "${extensions[@]}"; do
59
+ enable_extension "$ext" extension >/dev/null 2>&1 &
60
+ to_wait+=($!)
61
+ done
62
+ wait "${to_wait[@]}"
63
+ }
64
+
65
+ # Function to get a map of extensions and their dependent shared extensions.
66
+ get_extension_map() {
67
+ php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig >/dev/null 2>&1
68
+ }
69
+
70
+ # Function to enable extension dependencies which are also extensions.
71
+ enable_extension_dependencies() {
72
+ local extension=$1
73
+ local prefix=$2
74
+ [ -e /tmp/extdisabled/"$version"/"$extension" ] || return;
75
+ get_extension_map
76
+ for dependency in $(grep "$extension:" /tmp/map"$version".orig | cut -d ':' -f 2 | tr '\n' ' '); do
77
+ enable_extension "$dependency" "$prefix"
78
+ done
79
+ rm /tmp/extdisabled/"$version"/"$extension"
80
+ }
81
+
82
+ # Function to disable dependent extensions.
83
+ disable_extension_dependents() {
84
+ local extension=$1
85
+ for dependent in $(grep -E ".*:.*\s$extension(\s|$)" /tmp/map"$version".orig | cut -d ':' -f 1 | tr '\n' ' '); do
86
+ disable_extension_helper "$dependent" true
87
+ add_log "${tick:?}" ":$extension" "Disabled $dependent as it depends on $extension"
88
+ done
89
+ }
90
+
91
+ # Function to disable an extension.
92
+ disable_extension() {
93
+ local extension=$1
94
+ if check_extension "$extension"; then
95
+ if shared_extension "$extension"; then
96
+ disable_extension_helper "$extension" true
97
+ (! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Disabled") ||
98
+ add_log "${cross:?}" ":$extension" "Could not disable $extension on PHP ${semver:?}"
99
+ else
100
+ add_log "${cross:?}" ":$extension" "Could not disable $extension on PHP $semver as it not a shared extension"
101
+ fi
102
+ elif shared_extension "$extension"; then
103
+ add_log "${tick:?}" ":$extension" "Disabled"
104
+ else
105
+ add_log "${tick:?}" ":$extension" "Could not find $extension on PHP $semver"
106
+ fi
107
+ }
108
+
109
+ # Function to disable shared extensions.
110
+ disable_all_shared() {
111
+ get_extension_map
112
+ sudo sed -i.orig -E -e "/^(zend_)?extension\s*=/d" "${ini_file[@]}" "$pecl_file" 2>/dev/null || true
113
+ 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
114
+ mkdir -p /tmp/extdisabled/"$version"
115
+ sudo rm -f /tmp/php"$version"_extensions
116
+ sudo find "$ext_dir" -name '*.so' -print0 | xargs -0 -n 1 basename -s .so | xargs -n 1 -I{} touch /tmp/extdisabled/"$version"/{}
117
+ add_log "${tick:?}" "none" "Disabled all shared extensions"
118
+ }
119
+
120
+ # Function to configure PECL.
121
+ configure_pecl() {
122
+ if ! [ -e /tmp/pecl_config ]; then
123
+ for script in pear pecl; do
124
+ sudo "$script" config-set php_ini "${pecl_file:-${ini_file[@]}}"
125
+ sudo "$script" channel-update "$script".php.net
126
+ done
127
+ echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
128
+ fi
129
+ }
130
+
131
+ # Function to add an extension.
132
+ add_extension() {
133
+ local extension=$1
134
+ local prefix=$2
135
+ enable_extension "$extension" "$prefix"
136
+ if check_extension "$extension"; then
137
+ add_log "${tick:?}" "$extension" "Enabled"
138
+ else
139
+ add_extension_helper "$extension" "$prefix"
140
+ fi
141
+ }
142
+
143
+ # Function to get the PECL version of an extension.
144
+ get_pecl_version() {
145
+ local extension=$1
146
+ stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")"
147
+ pecl_rest='https://pecl.php.net/rest/r/'
148
+ response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
149
+ pecl_version=$(echo "$response" | grep -m 1 -Eio "([0-9]+\.[0-9]+\.[0-9]+${stability}[0-9]+)")
150
+ if [ ! "$pecl_version" ]; then
151
+ pecl_version=$(echo "$response" | grep -m 1 -Eo "([0-9]+\.[0-9]+\.[0-9]+)")
152
+ fi
153
+ echo "$pecl_version"
154
+ }
155
+
156
+ # Function to install PECL extensions and accept default options
157
+ pecl_install() {
158
+ local extension=$1
159
+ add_pecl >/dev/null 2>&1
160
+ ncpu="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo '1')"
161
+ prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $ncpu'"
162
+ suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
163
+ yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
164
+ }
165
+
166
+ # Function to install a specific version of PECL extension.
167
+ add_pecl_extension() {
168
+ local extension=$1
169
+ local pecl_version=$2
170
+ local prefix=$3
171
+ local message="Installed and enabled"
172
+ enable_extension "$extension" "$prefix"
173
+ if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
174
+ pecl_version=$(get_pecl_version "$extension" "$pecl_version")
175
+ fi
176
+ ext_version=$(php -r "echo phpversion('$extension');")
177
+ if [ "${ext_version/-/}" = "$pecl_version" ]; then
178
+ add_log "${tick:?}" "$extension" "Enabled"
179
+ else
180
+ IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
181
+ if (( ${#libraries[@]} )); then
182
+ add_libs "${libraries[@]}" >/dev/null 2>&1
183
+ message="$message with libraries ${libraries[*]}"
184
+ fi
185
+ disable_extension_helper "$extension" >/dev/null 2>&1
186
+ pecl_install "$extension-$pecl_version"
187
+ add_extension_log "$extension-$pecl_version" "$message"
188
+ fi
189
+ }
190
+
191
+ # Function to setup pre-release extensions using PECL.
192
+ add_unstable_extension() {
193
+ local extension=$1
194
+ local stability=$2
195
+ local prefix=$3
196
+ pecl_version=$(get_pecl_version "$extension" "$stability")
197
+ add_pecl_extension "$extension" "$pecl_version" "$prefix"
198
+ }
File without changes
File without changes
File without changes
@@ -1,10 +1,10 @@
1
1
  # Function to log license details.
2
2
  add_license_log() {
3
- printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
3
+ printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
4
4
  printf "Cubrid CCI package is required for %s extension.\n" "$ext"
5
5
  printf "The extension %s and Cubrid CCI are provided under the license linked below.\n" "$ext"
6
6
  printf "Refer to: \033[35;1m%s \033[0m\n" "https://github.com/CUBRID/cubrid-cci/blob/develop/COPYING"
7
- echo "::endgroup::"
7
+ echo "$END_GROUP"
8
8
  }
9
9
 
10
10
  # Function to setup gcc-7 and g++-7
@@ -57,4 +57,4 @@ add_cubrid() {
57
57
  }
58
58
 
59
59
  # shellcheck source=.
60
- . "${scripts:?}"/ext/patches/phpize.sh
60
+ . "${scripts:?}"/extensions/patches/phpize.sh
@@ -15,7 +15,7 @@ class ExtensionMap {
15
15
  /** @var string Prefix in PHP extension file. */
16
16
  private $file_prefix;
17
17
 
18
- /** @var string String to store the map */
18
+ /** @var array Array to store the map */
19
19
  private $map;
20
20
 
21
21
  /**
@@ -25,7 +25,23 @@ class ExtensionMap {
25
25
  $this->extension_dir = ini_get('extension_dir');
26
26
  $this->file_extension = (PHP_OS == 'WINNT' ? '.dll' : '.so');
27
27
  $this->file_prefix = (PHP_OS == 'WINNT' ? 'php_' : '');
28
- $this->map = '';
28
+ $this->map = array();
29
+ }
30
+
31
+ /**
32
+ * Function to read the extension map.
33
+ */
34
+ private function parseMap($path) {
35
+ if(file_exists($path)) {
36
+ $handle = fopen($path, "r");
37
+ if ($handle) {
38
+ while (($line = fgets($handle)) !== false) {
39
+ $line_parts = explode(':', $line);
40
+ $this->map[$line_parts[0]] = explode(' ', trim($line_parts[1]));
41
+ }
42
+ fclose($handle);
43
+ }
44
+ }
29
45
  }
30
46
 
31
47
  /**
@@ -34,7 +50,7 @@ class ExtensionMap {
34
50
  * @param string $extension
35
51
  * @return bool
36
52
  */
37
- public function checkSharedExtension($extension) {
53
+ private function checkSharedExtension($extension) {
38
54
  $extension_file = $this->extension_dir. DIRECTORY_SEPARATOR . $this->file_prefix . $extension . $this->file_extension;
39
55
  return file_exists($extension_file);
40
56
  }
@@ -44,7 +60,7 @@ class ExtensionMap {
44
60
  *
45
61
  * @return string[]
46
62
  */
47
- public function getSharedExtensions() {
63
+ private function getSharedExtensions() {
48
64
  $files = scandir($this->extension_dir);
49
65
  $extensions = array_diff($files, array('.','..'));
50
66
  $filter_pattern = "/$this->file_extension|$this->file_prefix/";
@@ -60,7 +76,7 @@ class ExtensionMap {
60
76
  * @param array $dependencies
61
77
  * @return array
62
78
  */
63
- public function patchDependencies($extension, $dependencies) {
79
+ private function patchDependencies($extension, $dependencies) {
64
80
  // memcached 2.2.0 has no dependencies in reflection data.
65
81
  if($extension == 'memcached') {
66
82
  $dependencies = array_unique(array_merge($dependencies, array('igbinary', 'json', 'msgpack')));
@@ -74,7 +90,10 @@ class ExtensionMap {
74
90
  * @param string $extension
75
91
  * @throws ReflectionException
76
92
  */
77
- public function addExtensionToMap($extension) {
93
+ private function addExtensionToMap($extension) {
94
+ if($this->map && array_key_exists($extension, $this->map) && !empty($this->map[$extension])) {
95
+ return;
96
+ }
78
97
  // PHP 5.3 does not allow using $this.
79
98
  $self = $this;
80
99
 
@@ -84,15 +103,15 @@ class ExtensionMap {
84
103
  $dependencies = array_filter($dependencies, function ($dependency) use ($self) {
85
104
  return $self->checkSharedExtension($dependency);
86
105
  });
87
- $self->map .= $extension . ': ' . implode(' ', $dependencies) . PHP_EOL;
106
+ $self->map[$extension] = $dependencies;
88
107
  }
89
108
 
90
109
  /**
91
- * Function to print the map of shared extensions and their dependent extensions.
92
- *
93
- * @return string
110
+ * Function to write the map of shared extensions and their dependent extensions.
94
111
  */
95
- public function __toString() {
112
+ public function write() {
113
+ $path = $_SERVER['argv'][1];
114
+ $this->parseMap($path);
96
115
  $extensions = array_map('strtolower', $this->getSharedExtensions());
97
116
  foreach ($extensions as $extension) {
98
117
  try {
@@ -101,9 +120,13 @@ class ExtensionMap {
101
120
 
102
121
  }
103
122
  }
104
- return $this->map;
123
+ $map_string = '';
124
+ foreach($this->map as $extension => $dependencies) {
125
+ $map_string .= $extension . ': ' . implode(' ', $dependencies) . PHP_EOL;
126
+ }
127
+ file_put_contents($path, $map_string);
105
128
  }
106
129
  }
107
130
 
108
131
  $extension_map = new ExtensionMap();
109
- echo $extension_map;
132
+ $extension_map->write();
File without changes
File without changes
File without changes
File without changes
@@ -40,6 +40,7 @@ Function Repair-ICU() {
40
40
  }
41
41
 
42
42
  Function Add-Http() {
43
+ Add-Extension iconv >$null 2>&1
43
44
  Add-Extension raphf >$null 2>&1
44
45
  if($version -lt '8.0') {
45
46
  Add-Extension propro >$null 2>&1
@@ -11,33 +11,27 @@ get_http_version() {
11
11
 
12
12
  # Function to enable http extension.
13
13
  enable_http() {
14
+ enable_extension iconv extension
14
15
  enable_extension propro extension
15
16
  enable_extension raphf extension
16
- if (! [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension propro && check_extension raphf) ||
17
- ( [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension raphf); then
17
+ if (! [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension iconv && check_extension propro && check_extension raphf) ||
18
+ ( [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension iconv && check_extension raphf); then
18
19
  enable_extension http extension
19
20
  fi
20
21
  }
21
22
 
22
- # Function to install extensions.
23
- add_extension_helper() {
24
- if [ "$os" = "Linux" ]; then
25
- add_extension "$1" extension
26
- else
27
- add_brew_extension "$1" extension
28
- fi
29
- }
30
-
31
23
  # Function to install http dependencies.
32
24
  add_http_dependencies() {
33
25
  if [[ ${version:?} =~ ${old_versions:?} ]]; then
34
26
  add_pecl_extension raphf 1.1.2 extension
35
27
  add_pecl_extension propro 1.0.2 extension
36
28
  elif [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
37
- add_extension_helper propro
38
- add_extension_helper raphf
29
+ add_extension iconv extension
30
+ add_extension propro extension
31
+ add_extension raphf extension
39
32
  else
40
- add_extension_helper raphf
33
+ add_extension iconv extension
34
+ add_extension raphf extension
41
35
  fi
42
36
  }
43
37
 
@@ -78,13 +72,11 @@ add_http_helper() {
78
72
  add_http_latest() {
79
73
  enable_http
80
74
  if ! check_extension http; then
81
- add_http_dependencies
82
75
  if [ "$os" = "Linux" ]; then
83
- if ! [[ "${version:?}" =~ ${old_versions:?}|${nightly_versions:?} ]]; then
84
- install_packages "php$version-http"
85
- else
86
- add_http_helper "$(get_http_version)" "$os"
87
- fi
76
+ add_http_dependencies
77
+ package="php$version-http"
78
+ add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
79
+ (check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
88
80
  else
89
81
  if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
90
82
  add_brew_extension pecl_http extension
@@ -99,6 +91,7 @@ add_http_version() {
99
91
  ext=$1
100
92
  enable_http
101
93
  if [ "x$(php -r "echo phpversion('http');")" != "x${ext##*-}" ]; then
94
+ add_http_dependencies
102
95
  disable_extension_helper http >/dev/null
103
96
  add_http_helper pecl_http-"${ext##*-}" "$os"
104
97
  status="Installed and enabled"
File without changes
@@ -1,8 +1,8 @@
1
1
  # Function to log result of a operation.
2
2
  Function Add-LicenseLog() {
3
- printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
3
+ printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
4
4
  Get-Content $ext_dir\ioncube\LICENSE.txt
5
- Write-Output "::endgroup::"
5
+ Write-Output "$env:END_GROUP"
6
6
  }
7
7
 
8
8
  # Function to add ioncube extension.
@@ -1,8 +1,8 @@
1
1
  # Function to log result of a operation.
2
2
  add_license_log() {
3
- printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
3
+ printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
4
4
  cat "${ext_dir:?}"/IONCUBE_LICENSE.txt
5
- echo "::endgroup::"
5
+ echo "$END_GROUP"
6
6
  }
7
7
 
8
8
  # Function to install ioncube.