Skip to content

Commit

Permalink
Implement ioncube support on unix correctly
Browse files Browse the repository at this point in the history
I think I jumped the shark with this one for this project
  • Loading branch information
shivammathur committed May 22, 2024
1 parent d6560b1 commit 376a964
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
):
Expand Down Expand Up @@ -137,15 +137,15 @@ 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
case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(
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
):
Expand Down Expand Up @@ -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):
Expand All @@ -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
):
Expand Down
21 changes: 16 additions & 5 deletions src/scripts/extensions/ioncube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 376a964

Please sign in to comment.