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.
Files changed (134) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +990 -922
  3. package/lib/config.d.ts +3 -0
  4. package/lib/config.js +71 -71
  5. package/lib/config.js.map +1 -1
  6. package/lib/coverage.d.ts +5 -0
  7. package/lib/coverage.js +97 -87
  8. package/lib/coverage.js.map +1 -1
  9. package/lib/extensions.d.ts +4 -0
  10. package/lib/extensions.js +214 -200
  11. package/lib/extensions.js.map +1 -1
  12. package/lib/fetch.d.ts +1 -0
  13. package/lib/fetch.js +63 -0
  14. package/lib/fetch.js.map +1 -0
  15. package/lib/install.d.ts +2 -0
  16. package/lib/install.js +75 -81
  17. package/lib/install.js.map +1 -1
  18. package/lib/tools.d.ts +23 -0
  19. package/lib/tools.js +367 -386
  20. package/lib/tools.js.map +1 -1
  21. package/lib/utils.d.ts +21 -0
  22. package/lib/utils.js +261 -291
  23. package/lib/utils.js.map +1 -1
  24. package/package.json +67 -56
  25. package/src/config.ts +82 -82
  26. package/src/configs/brew_extensions +31 -0
  27. package/src/configs/composer.env +2 -0
  28. package/src/configs/ini/jit.ini +3 -0
  29. package/src/configs/ini/php.ini +2 -0
  30. package/src/configs/ini/xdebug.ini +1 -0
  31. package/src/configs/os_releases.csv +19 -17
  32. package/src/configs/php-versions.json +6 -5
  33. package/src/configs/php_packages +12 -0
  34. package/src/configs/{php.json → pm/php.json} +29 -29
  35. package/src/configs/{phpunit.json → pm/phpunit.json} +24 -24
  36. package/src/configs/tools.json +278 -235
  37. package/src/configs/tools_schema.json +125 -114
  38. package/src/coverage.ts +144 -142
  39. package/src/extensions.ts +367 -349
  40. package/src/fetch.ts +54 -0
  41. package/src/install.ts +66 -82
  42. package/src/scripts/darwin.sh +285 -249
  43. package/src/scripts/extensions/add_extensions.ps1 +194 -0
  44. package/src/scripts/extensions/add_extensions.sh +184 -0
  45. package/src/scripts/{ext → extensions}/blackfire.ps1 +32 -32
  46. package/src/scripts/{ext → extensions}/blackfire.sh +22 -21
  47. package/src/scripts/{ext → extensions}/couchbase.sh +43 -43
  48. package/src/scripts/{ext → extensions}/cubrid.sh +60 -60
  49. package/src/scripts/extensions/extension_map.php +132 -0
  50. package/src/scripts/{ext → extensions}/firebird.ps1 +19 -19
  51. package/src/scripts/{ext → extensions}/firebird.sh +39 -35
  52. package/src/scripts/{ext → extensions}/gearman.sh +22 -22
  53. package/src/scripts/{ext → extensions}/geos.sh +17 -17
  54. package/src/scripts/{ext → extensions}/http.ps1 +54 -54
  55. package/src/scripts/{ext → extensions}/http.sh +109 -120
  56. package/src/scripts/{ext → extensions}/intl.sh +23 -23
  57. package/src/scripts/{ext → extensions}/ioncube.ps1 +33 -32
  58. package/src/scripts/{ext → extensions}/ioncube.sh +21 -19
  59. package/src/scripts/{ext → extensions}/oci.ps1 +85 -60
  60. package/src/scripts/{ext → extensions}/oci.sh +65 -63
  61. package/src/scripts/{ext → extensions}/patches/firebird.sh +11 -11
  62. package/src/scripts/{ext → extensions}/patches/geos.sh +7 -7
  63. package/src/scripts/{ext → extensions}/patches/http.sh +11 -11
  64. package/src/scripts/{ext → extensions}/patches/pdo_oci.sh +6 -6
  65. package/src/scripts/{ext → extensions}/patches/phpize.sh +26 -26
  66. package/src/scripts/{ext → extensions}/patches/protobuf.sh +4 -4
  67. package/src/scripts/{ext → extensions}/phalcon.ps1 +54 -54
  68. package/src/scripts/{ext → extensions}/phalcon.sh +58 -58
  69. package/src/scripts/{ext → extensions}/source.sh +145 -144
  70. package/src/scripts/extensions/sqlsrv.sh +15 -0
  71. package/src/scripts/linux.sh +269 -256
  72. package/src/scripts/tools/add_tools.ps1 +239 -26
  73. package/src/scripts/tools/add_tools.sh +175 -20
  74. package/src/scripts/tools/blackfire.ps1 +19 -19
  75. package/src/scripts/tools/blackfire.sh +40 -39
  76. package/src/scripts/tools/grpc_php_plugin.ps1 +21 -21
  77. package/src/scripts/tools/grpc_php_plugin.sh +58 -58
  78. package/src/scripts/tools/ppa.sh +192 -151
  79. package/src/scripts/tools/protoc.ps1 +38 -38
  80. package/src/scripts/tools/protoc.sh +28 -28
  81. package/src/scripts/tools/symfony.ps1 +14 -0
  82. package/src/scripts/tools/symfony.sh +13 -0
  83. package/src/scripts/unix.sh +186 -0
  84. package/src/scripts/win32.ps1 +352 -494
  85. package/src/tools.ts +512 -538
  86. package/src/utils.ts +415 -500
  87. package/.eslintrc.json +0 -16
  88. package/.github/CODE_OF_CONDUCT.md +0 -76
  89. package/.github/CONTRIBUTING.md +0 -70
  90. package/.github/FUNDING.yml +0 -7
  91. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
  92. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
  93. package/.github/PULL_REQUEST_TEMPLATE.md +0 -37
  94. package/.github/SECURITY.md +0 -29
  95. package/.github/workflows/docs.yml +0 -77
  96. package/.github/workflows/node-workflow.yml +0 -51
  97. package/.github/workflows/workflow.yml +0 -78
  98. package/.idea/workspace.xml +0 -113
  99. package/.prettierrc.json +0 -12
  100. package/__tests__/config.test.ts +0 -52
  101. package/__tests__/coverage.test.ts +0 -110
  102. package/__tests__/extensions.test.ts +0 -263
  103. package/__tests__/install.test.ts +0 -175
  104. package/__tests__/tools.test.ts +0 -524
  105. package/__tests__/utils.test.ts +0 -307
  106. package/action.yml +0 -29
  107. package/dist/index.js +0 -3051
  108. package/examples/bedrock.yml +0 -32
  109. package/examples/blackfire-player.yml +0 -31
  110. package/examples/blackfire.yml +0 -31
  111. package/examples/cakephp-mysql.yml +0 -114
  112. package/examples/cakephp-postgres.yml +0 -112
  113. package/examples/cakephp.yml +0 -92
  114. package/examples/codeigniter.yml +0 -34
  115. package/examples/laravel-mysql.yml +0 -74
  116. package/examples/laravel-postgres.yml +0 -74
  117. package/examples/laravel.yml +0 -42
  118. package/examples/lumen-mysql.yml +0 -74
  119. package/examples/lumen-postgres.yml +0 -74
  120. package/examples/lumen.yml +0 -38
  121. package/examples/phalcon-mysql.yml +0 -74
  122. package/examples/phalcon-postgres.yml +0 -73
  123. package/examples/sage.yml +0 -57
  124. package/examples/slim-framework.yml +0 -34
  125. package/examples/symfony-mysql.yml +0 -57
  126. package/examples/symfony-postgres.yml +0 -55
  127. package/examples/symfony.yml +0 -39
  128. package/examples/yii2-mysql.yml +0 -73
  129. package/examples/yii2-postgres.yml +0 -71
  130. package/examples/zend-framework.yml +0 -36
  131. package/jest.config.js +0 -12
  132. package/lib/sapi.js +0 -64
  133. package/src/scripts/common.sh +0 -314
  134. package/tsconfig.json +0 -18
@@ -1,120 +1,109 @@
1
- # Function to get http version for a PHP version.
2
- get_http_version() {
3
- if [[ ${version:?} =~ 5.[3-6] ]]; then
4
- echo "pecl_http-2.6.0"
5
- elif [[ ${version:?} =~ 7.[0-4] ]]; then
6
- echo "pecl_http-3.2.4"
7
- else
8
- echo "pecl_http-$(get_pecl_version "pecl_http" "stable")"
9
- fi
10
- }
11
-
12
- # Function to enable http extension.
13
- enable_http() {
14
- enable_extension propro extension
15
- enable_extension raphf extension
16
- if (! [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension propro && check_extension raphf) ||
17
- ( [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension raphf); then
18
- enable_extension http extension
19
- fi
20
- }
21
-
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
- # Function to install http dependencies.
32
- add_http_dependencies() {
33
- if [[ ${version:?} =~ ${old_versions:?} ]]; then
34
- add_pecl_extension raphf 1.1.2 extension
35
- add_pecl_extension propro 1.0.2 extension
36
- elif [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
37
- add_extension_helper propro
38
- add_extension_helper raphf
39
- else
40
- add_extension_helper raphf
41
- fi
42
- }
43
-
44
- # Function to get configure options for http.
45
- get_http_configure_opts() {
46
- if [ "$os" = 'Linux' ]; then
47
- for lib in zlib libbrotli libcurl libevent libicu libidn2 libidn libidnkit2 libidnkit; do
48
- http_opts+=( "--with-http-$lib-dir=/usr" )
49
- done
50
- else
51
- http_opts+=( "--with-http-zlib-dir=$(xcrun --show-sdk-path)/usr" )
52
- http_opts+=( "--with-http-libbrotli-dir=$(brew --prefix brotli)" )
53
- http_opts+=( "--with-http-libcurl-dir=$(brew --prefix curl)" )
54
- http_opts+=( "--with-http-libicu-dir=$(brew --prefix icu4c)" )
55
- http_opts+=( "--with-http-libevent-dir=$(brew --prefix libevent)" )
56
- http_opts+=( "--with-http-libidn2-dir=$(brew --prefix libidn2)" )
57
- fi
58
- }
59
-
60
- # Compile and install http explicitly.
61
- # This is done as pecl compiles raphf and propro as well.
62
- add_http_helper() {
63
- ext=$1
64
- http_opts=() && get_http_configure_opts
65
- export HTTP_PREFIX_CONFIGURE_OPTS="CFLAGS=-Wno-implicit-function-declaration"
66
- http_configure_opts="--with-http --with-php-config=$(command -v php-config) ${http_opts[*]}"
67
- export HTTP_CONFIGURE_OPTS="$http_configure_opts"
68
- export HTTP_LINUX_LIBS="zlib1g libbrotli-dev libcurl4-openssl-dev libevent-dev libicu-dev libidn2-dev"
69
- export HTTP_DARWIN_LIBS="brotli curl icu4c libevent libidn2"
70
- if [[ "${version:?}" =~ ${nightly_versions:?} ]]; then
71
- add_extension_from_source http https://github.com m6w6 ext-http master extension
72
- else
73
- add_extension_from_source pecl_http https://pecl.php.net http http "${ext##*-}" extension pecl
74
- fi
75
- }
76
-
77
- # Function to setup latest http extension.
78
- add_http_latest() {
79
- enable_http
80
- if ! check_extension http; then
81
- add_http_dependencies
82
- 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
88
- else
89
- if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
90
- add_brew_extension pecl_http extension
91
- fi
92
- fi
93
- status="Installed and enabled"
94
- fi
95
- }
96
-
97
- # Function to setup http extension given a version.
98
- add_http_version() {
99
- ext=$1
100
- enable_http
101
- if [ "x$(php -r "echo phpversion('http');")" != "x${ext##*-}" ]; then
102
- remove_extension http >/dev/null
103
- add_http_helper pecl_http-"${ext##*-}" "$os"
104
- status="Installed and enabled"
105
- fi
106
- }
107
-
108
- # Function to setup http extension
109
- add_http() {
110
- ext=$1
111
- status="Enabled"
112
- if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
113
- add_http_latest >/dev/null 2>&1
114
- else
115
- add_http_version "$ext" >/dev/null 2>&1
116
- fi
117
- add_extension_log "http" "$status"
118
- }
119
-
120
- os="$(uname -s)"
1
+ # Function to get http version for a PHP version.
2
+ get_http_version() {
3
+ if [[ ${version:?} =~ 5.[3-6] ]]; then
4
+ echo "pecl_http-2.6.0"
5
+ elif [[ ${version:?} =~ 7.[0-4] ]]; then
6
+ echo "pecl_http-3.2.4"
7
+ else
8
+ echo "pecl_http-$(get_pecl_version "pecl_http" "stable")"
9
+ fi
10
+ }
11
+
12
+ # Function to enable http extension.
13
+ enable_http() {
14
+ enable_extension propro extension
15
+ enable_extension raphf extension
16
+ if (! [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension propro && check_extension raphf) ||
17
+ ( [[ ${version:?} =~ ${jit_versions:?} ]] && check_extension raphf); then
18
+ enable_extension http extension
19
+ fi
20
+ }
21
+
22
+ # Function to install http dependencies.
23
+ add_http_dependencies() {
24
+ if [[ ${version:?} =~ ${old_versions:?} ]]; then
25
+ add_pecl_extension raphf 1.1.2 extension
26
+ add_pecl_extension propro 1.0.2 extension
27
+ elif [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
28
+ add_extension_helper propro
29
+ add_extension_helper raphf
30
+ else
31
+ add_extension_helper raphf
32
+ fi
33
+ }
34
+
35
+ # Function to get configure options for http.
36
+ get_http_configure_opts() {
37
+ if [ "$os" = 'Linux' ]; then
38
+ for lib in zlib libbrotli libcurl libevent libicu libidn2 libidn libidnkit2 libidnkit; do
39
+ http_opts+=( "--with-http-$lib-dir=/usr" )
40
+ done
41
+ else
42
+ http_opts+=( "--with-http-zlib-dir=$(xcrun --show-sdk-path)/usr" )
43
+ http_opts+=( "--with-http-libbrotli-dir=$(brew --prefix brotli)" )
44
+ http_opts+=( "--with-http-libcurl-dir=$(brew --prefix curl)" )
45
+ http_opts+=( "--with-http-libicu-dir=$(brew --prefix icu4c)" )
46
+ http_opts+=( "--with-http-libevent-dir=$(brew --prefix libevent)" )
47
+ http_opts+=( "--with-http-libidn2-dir=$(brew --prefix libidn2)" )
48
+ fi
49
+ }
50
+
51
+ # Compile and install http explicitly.
52
+ # This is done as pecl compiles raphf and propro as well.
53
+ add_http_helper() {
54
+ ext=$1
55
+ http_opts=() && get_http_configure_opts
56
+ export HTTP_PREFIX_CONFIGURE_OPTS="CFLAGS=-Wno-implicit-function-declaration"
57
+ http_configure_opts="--with-http --with-php-config=$(command -v php-config) ${http_opts[*]}"
58
+ export HTTP_CONFIGURE_OPTS="$http_configure_opts"
59
+ export HTTP_LINUX_LIBS="zlib1g libbrotli-dev libcurl4-openssl-dev libevent-dev libicu-dev libidn2-dev"
60
+ export HTTP_DARWIN_LIBS="brotli curl icu4c libevent libidn2"
61
+ if [[ "${version:?}" =~ ${nightly_versions:?} ]]; then
62
+ add_extension_from_source http https://github.com m6w6 ext-http master extension
63
+ else
64
+ add_extension_from_source pecl_http https://pecl.php.net http http "${ext##*-}" extension pecl
65
+ fi
66
+ }
67
+
68
+ # Function to setup latest http extension.
69
+ add_http_latest() {
70
+ enable_http
71
+ if ! check_extension http; then
72
+ if [ "$os" = "Linux" ]; then
73
+ add_http_dependencies
74
+ package="php$version-http"
75
+ add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
76
+ (check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
77
+ else
78
+ if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
79
+ add_brew_extension pecl_http extension
80
+ fi
81
+ fi
82
+ status="Installed and enabled"
83
+ fi
84
+ }
85
+
86
+ # Function to setup http extension given a version.
87
+ add_http_version() {
88
+ ext=$1
89
+ enable_http
90
+ if [ "x$(php -r "echo phpversion('http');")" != "x${ext##*-}" ]; then
91
+ disable_extension_helper http >/dev/null
92
+ add_http_helper pecl_http-"${ext##*-}" "$os"
93
+ status="Installed and enabled"
94
+ fi
95
+ }
96
+
97
+ # Function to setup http extension
98
+ add_http() {
99
+ ext=$1
100
+ status="Enabled"
101
+ if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
102
+ add_http_latest >/dev/null 2>&1
103
+ else
104
+ add_http_version "$ext" >/dev/null 2>&1
105
+ fi
106
+ add_extension_log "http" "$status"
107
+ }
108
+
109
+ os="$(uname -s)"
@@ -1,23 +1,23 @@
1
- # Function to install ICU
2
- install_icu() {
3
- icu=$1
4
- if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then
5
- get -q -n /tmp/icu.tar.zst "https://github.com/shivammathur/icu-intl/releases/download/icu4c/icu4c-$icu.tar.zst"
6
- sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
7
- sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
8
- fi
9
- }
10
-
11
- # Function to add ext-intl with the given version of ICU
12
- add_intl() {
13
- icu=$(echo "$1" | cut -d'-' -f 2)
14
- supported_version=$(get -s -n "" https://api.github.com/repos/shivammathur/icu-intl/releases | grep -Po "${icu//./\\.}" | head -n 1)
15
- if [ "$icu" != "$supported_version" ]; then
16
- add_log "${cross:?}" "intl" "ICU $icu is not supported"
17
- else
18
- install_icu "$icu" >/dev/null 2>&1
19
- get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu.so"
20
- enable_extension intl extension
21
- add_extension_log intl "Installed and enabled with ICU $icu"
22
- fi
23
- }
1
+ # Function to install ICU
2
+ install_icu() {
3
+ icu=$1
4
+ if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then
5
+ get -q -n /tmp/icu.tar.zst "https://github.com/shivammathur/icu-intl/releases/download/icu4c/icu4c-$icu.tar.zst"
6
+ sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
7
+ sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
8
+ fi
9
+ }
10
+
11
+ # Function to add ext-intl with the given version of ICU
12
+ add_intl() {
13
+ icu=$(echo "$1" | cut -d'-' -f 2)
14
+ supported_version=$(get -s -n "" https://api.github.com/repos/shivammathur/icu-intl/releases | grep -Po "${icu//./\\.}" | head -n 1)
15
+ if [ "$icu" != "$supported_version" ]; then
16
+ add_log "${cross:?}" "intl" "ICU $icu is not supported"
17
+ else
18
+ install_icu "$icu" >/dev/null 2>&1
19
+ get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu.so"
20
+ enable_extension intl extension
21
+ add_extension_log intl "Installed and enabled with ICU $icu"
22
+ fi
23
+ }
@@ -1,32 +1,33 @@
1
- # Function to log result of a operation.
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"
4
- Get-Content $ext_dir\ioncube\LICENSE.txt
5
- Write-Output "::endgroup::"
6
- }
7
-
8
- # Function to add ioncube extension.
9
- Function Add-Ioncube() {
10
- try {
11
- if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
12
- $status = 'Installed and enabled'
13
- $arch_part = $arch
14
- if ($arch -eq 'x64') {
15
- $arch_part = 'x86-64'
16
- }
17
- $vc = $installed.VCVersion
18
- $ts_part = ""
19
- if (-not($installed.ThreadSafe)) {
20
- $ts_part = "_nonts"
21
- }
22
- Invoke-WebRequest -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
23
- Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
24
- Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
25
- }
26
- "zend_extension=$ext_dir\php_ioncube.dll`r`n" + (Get-Content $php_dir\php.ini -Raw) | Set-Content $php_dir\php.ini
27
- Add-Log $tick "ioncube" $status
28
- Add-LicenseLog
29
- } catch {
30
- Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
31
- }
32
- }
1
+ # Function to log result of a operation.
2
+ Function Add-LicenseLog() {
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
+ Get-Content $ext_dir\ioncube\LICENSE.txt
5
+ Write-Output "$env:END_GROUP"
6
+ }
7
+
8
+ # Function to add ioncube extension.
9
+ Function Add-Ioncube() {
10
+ try {
11
+ $status = 'Enabled'
12
+ if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
13
+ $status = 'Installed and enabled'
14
+ $arch_part = $arch
15
+ if ($arch -eq 'x64') {
16
+ $arch_part = 'x86-64'
17
+ }
18
+ $vc = $installed.VCVersion
19
+ $ts_part = ""
20
+ if (-not($installed.ThreadSafe)) {
21
+ $ts_part = "_nonts"
22
+ }
23
+ Invoke-WebRequest -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
24
+ Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
25
+ Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
26
+ }
27
+ "zend_extension=$ext_dir\php_ioncube.dll`r`n" + (Get-Content $php_dir\php.ini -Raw) | Set-Content $php_dir\php.ini
28
+ Add-Log $tick "ioncube" $status
29
+ Add-LicenseLog
30
+ } catch {
31
+ Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
32
+ }
33
+ }
@@ -1,19 +1,21 @@
1
- # Function to log result of a operation.
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"
4
- cat /tmp/ioncube/LICENSE.txt
5
- echo "::endgroup::"
6
- }
7
-
8
- # Function to install ioncube.
9
- add_ioncube() {
10
- if [ ! -e "${ext_dir:?}/ioncube.so" ]; then
11
- status='Installed and enabled'
12
- os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
13
- get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
14
- sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "$ext_dir/ioncube.so"
15
- fi
16
- echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
17
- add_extension_log "ioncube" "$status"
18
- check_extension "ioncube" && add_license_log
19
- }
1
+ # Function to log result of a operation.
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"
4
+ cat "${ext_dir:?}"/IONCUBE_LICENSE.txt
5
+ echo "$END_GROUP"
6
+ }
7
+
8
+ # Function to install ioncube.
9
+ add_ioncube() {
10
+ status='Enabled'
11
+ if ! shared_extension ioncube; then
12
+ status='Installed and enabled'
13
+ os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
14
+ get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
15
+ sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "${ext_dir:?}/ioncube.so"
16
+ sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
17
+ fi
18
+ echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
19
+ add_extension_log "ioncube" "$status"
20
+ check_extension "ioncube" && add_license_log
21
+ }
@@ -1,60 +1,85 @@
1
- # Function to log license information.
2
- Function Add-LicenseLog() {
3
- printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
4
- printf "Oracle Instant Client package is required for %s extension.\n" $extension
5
- printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
6
- printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
7
- Write-Output "::endgroup::"
8
- }
9
-
10
- # Function to get instantclinet.
11
- Function Add-InstantClient() {
12
- if (-not(Test-Path $php_dir\oci.dll)) {
13
- $suffix = 'windows'
14
- if ($arch -eq 'x86') {
15
- $suffix = 'nt'
16
- }
17
- Invoke-WebRequest -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
18
- Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
19
- Copy-Item $php_dir\instantclient*\* $php_dir
20
- }
21
- }
22
-
23
- # Function to install oci8 and pdo_oci.
24
- Function Add-Oci() {
25
- Param (
26
- [Parameter(Position = 0, Mandatory = $true)]
27
- [ValidateNotNull()]
28
- [ValidateSet('oci8', 'pdo_oci')]
29
- [string]
30
- $extension
31
- )
32
- try {
33
- $status = 'Enabled'
34
- Add-InstantClient
35
- if ($extension -eq "pdo_oci") {
36
- Enable-PhpExtension pdo_oci -Path $php_dir
37
- } else {
38
- if(-not(Test-Path $ext_dir\php_oci8.dll)) {
39
- $status = 'Installed and enabled'
40
- $ociVersion = Get-PeclPackageVersion oci8 -MinimumStability stable -MaximumStability stable | Select-Object -First 1
41
- if ($version -eq '7.0') {
42
- $ociVersion = '2.1.8'
43
- } elseif ($version -lt '7.0') {
44
- $ociVersion = '2.0.12'
45
- } elseif ($version -lt '8.0') {
46
- $ociVersion = '2.2.0'
47
- }
48
- $ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
49
- Invoke-WebRequest -Uri $ociUrl -OutFile $php_dir\oci8.zip
50
- Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
51
-
52
- }
53
- Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
54
- }
55
- Add-Log $tick $extension $status
56
- Add-LicenseLog
57
- } catch {
58
- Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
59
- }
60
- }
1
+ # Function to log license information.
2
+ Function Add-LicenseLog() {
3
+ printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
4
+ printf "Oracle Instant Client package is required for %s extension.\n" $extension
5
+ printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
6
+ printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
7
+ Write-Output "$env:END_GROUP"
8
+ }
9
+
10
+ # Function to get instantclinet.
11
+ Function Add-InstantClient() {
12
+ if (-not(Test-Path $php_dir\oci.dll)) {
13
+ $suffix = 'windows'
14
+ if ($arch -eq 'x86') {
15
+ $suffix = 'nt'
16
+ }
17
+ Invoke-WebRequest -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
18
+ Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
19
+ Copy-Item $php_dir\instantclient*\* $php_dir
20
+ }
21
+ }
22
+
23
+ # Function to oci8 extension URL.
24
+ Function Get-Oci8Url() {
25
+ if($version -lt '8.0') {
26
+ $ociVersion = '2.2.0'
27
+ if ($version -eq '7.0') {
28
+ $ociVersion = '2.1.8'
29
+ } elseif ($version -lt '7.0') {
30
+ $ociVersion = '2.0.12'
31
+ }
32
+ return Get-PeclArchiveUrl oci8 $ociVersion $installed
33
+ } else {
34
+ $ociUrl = '';
35
+ Get-PeclPackageVersion oci8 -MinimumStability stable -MaximumStability stable | ForEach-Object {
36
+ $ociUrl = Get-PeclArchiveUrl oci8 $_ $installed
37
+ if($ociUrl) {
38
+ return $ociUrl
39
+ }
40
+ }
41
+ }
42
+ }
43
+
44
+ # Function to get OCI8 DLL.
45
+ Function Get-Oci8DLL() {
46
+ Get-ChildItem $ext_dir\php_oci8*.dll | ForEach-Object {
47
+ if((Get-PhpExtension -Path $_).PhpVersion -eq $version) {
48
+ return $_
49
+ }
50
+ }
51
+ }
52
+
53
+ # Function to install oci8 and pdo_oci.
54
+ Function Add-Oci() {
55
+ Param (
56
+ [Parameter(Position = 0, Mandatory = $true)]
57
+ [ValidateNotNull()]
58
+ [ValidateSet('oci8', 'pdo_oci')]
59
+ [string]
60
+ $extension
61
+ )
62
+ try {
63
+ $status = 'Enabled'
64
+ Add-InstantClient
65
+ if ($extension -eq "pdo_oci") {
66
+ Enable-PhpExtension pdo_oci -Path $php_dir
67
+ } else {
68
+ if(-not(Test-Path $ext_dir\php_oci8.dll)) {
69
+ $oci8DLL = Get-Oci8DLL
70
+ if($oci8DLL) {
71
+ Copy-Item -Path $oci8DLL -Destination $ext_dir\php_oci8.dll
72
+ } else {
73
+ $status = 'Installed and enabled'
74
+ Invoke-WebRequest -Uri (Get-Oci8Url) -OutFile $php_dir\oci8.zip
75
+ Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
76
+ }
77
+ }
78
+ Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
79
+ }
80
+ Add-Log $tick $extension $status
81
+ Add-LicenseLog
82
+ } catch {
83
+ Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
84
+ }
85
+ }