Implement ioncube support on unix correctly

I think I jumped the shark with this one for this project
This commit is contained in:
Shivam Mathur 2024-05-22 06:54:49 +05:30
parent d6560b1fbb
commit 376a964e21
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
3 changed files with 23 additions and 12 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@ export async function addExtensionDarwin(
// match 5.3blackfire...8.3blackfire
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
// match 5.3ioncube...7.4ioncube
// match 5.3ioncube...8.2ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.3phalcon5
// match 7.0zephir_parser...8.2zephir_parser
case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
@ -45,7 +45,7 @@ export async function addExtensionDarwin(
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
extension
):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])ioncube$/.test(version_extension):
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-3])phalcon5?/.test(
version_extension
):
@ -137,7 +137,7 @@ export async function addExtensionWindows(
// match 5.3blackfire...8.3blackfire
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
// match pdo_oci and oci8
// match 5.3ioncube...7.4ioncube
// match 5.3ioncube...8.2ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.3phalcon5
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
// match 7.0zephir_parser...8.2zephir_parser
@ -145,7 +145,7 @@ export async function addExtensionWindows(
version_extension
):
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-3])phalcon5?$/.test(
version_extension
):
@ -268,7 +268,7 @@ export async function addExtensionLinux(
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
// match 5.3ioncube...7.4ioncube
// match 5.3ioncube...8.2ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.3phalcon5
// match 7.0zephir_parser...8.2zephir_parser
case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
@ -282,7 +282,7 @@ export async function addExtensionLinux(
extension
):
case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-3])phalcon5?$/.test(
version_extension
):

View File

@ -10,12 +10,23 @@ add_ioncube() {
status='Enabled'
if ! shared_extension ioncube; then
status='Installed and enabled'
os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "${ext_dir:?}/ioncube.so"
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
arch="$(uname -m)"
if [ "$(uname -s)" = "Darwin" ]; then
[ "$arch" = "arm64" ] && os_suffix="dar_arm64" || os_suffix="mac_x86-64"
else
[[ "$arch" = "i386" || "$arch" = "i686" ]] && arch=x86
[[ "$arch" = "x86_64" ]] && arch=x86-64
os_suffix="lin_$arch"
fi
ts_part="" && [ "${ts:?}" = "zts" ] && ts_part="_ts"
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_suffix".tar.gz | tar -xzf - -C /tmp
loader_file=/tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so
if [ -e "$loader_file" ]; then
sudo mv /tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so "${ext_dir:?}/ioncube.so"
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
fi
fi
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
add_extension_log "ioncube" "$status"
check_extension "ioncube" && add_license_log
}