#!/bin/bash
# ionCube Installer/Updates by CWP
####################################

arch=$(uname -m)
if [[ $arch == "x86_64" ]]; then
        platform="x86-64"
        libdir=/usr/lib64
else
        platform="x86"
        libdir=/usr/lib
fi


ioncube="http://dl1.centos-webpanel.com/files/php/ioncube_loaders_lin_$platform.tar.gz"

cd /tmp

# Clean OLD ionCube
###########################
rm -Rf /usr/local/ioncube
rm -Rf ioncube
rm -f ioncube_loaders_lin_*.tar.gz


# Install ionCube
###########################
wget -q $ioncube
tar -xf ioncube_loaders_lin_*.tar.gz
mv ioncube/ /usr/local/
rm -f ioncube_loaders_lin_*.tar.gz


# ::: INFO :::
# We will not define restarts required here as you need to know for what you are using ioncube and then restart that service.
# With CWP you will need to restart httpd and cwpsrv.

if [ "$1" = "restart" ];then
	sh /scripts/restart_cwpsrv
fi
