Mini Shell

Direktori : /usr/share/i360-php/easyapache3/
Upload File :
Current File : //usr/share/i360-php/easyapache3/i360.hook

#!/usr/bin/bash

CMD=$1

IS_EA4="/etc/cpanel/ea4/is_ea4"
INI_PATH="/usr/local/lib/php.ini"
HOOK="/scripts/posteasyapache"

function get_native_version()
{
    if [ -x /usr/local/bin/php ]; then
        VER=$(/usr/local/bin/php -r "echo PHP_VERSION;" | cut -c 1,3);
        PHP="php$VER"
        echo $PHP
    fi
        echo ""
}

function remove_i360()
{
    if [ -d "/usr/local/cpanel/whostmgr/docroot/" -a ! -e "$IS_EA4" ]; then
        echo "i360: Easyapache3 found"
        if [ -e "$INI_PATH" ]; then
            SO_DIR=$(cat "$INI_PATH" | grep extension_dir);
            SO_DIR=$(echo $SO_DIR | cut -d '"' -f2);
            IS_I360=$(cat "$INI_PATH" | grep i360);
            if [ -n "$IS_I360" ]; then
                sed -i '/i360\./d' "$INI_PATH"
                sed -i '/\[i360\]/d' "$INI_PATH"
            fi
            echo "i360: extension_dir $SO_DIR"
            if [ -e $SO_DIR/i360.so ]; then
                rm -rf $SO_DIR/i360.so
            fi
            if [ -x /usr/sbin/cagefsctl ]; then
                cagefsctl --force-update
            fi
        fi
    fi
}

function remove_hook()
{
    if [ -d "/usr/local/cpanel/whostmgr/docroot/" -a ! -e "$IS_EA4" ]; then
        echo "i360: Easyapache3 found"
        if [ -e "$HOOK" ]; then
            IS_I360=$(cat "$HOOK" | grep i360);
            if [ -n "$IS_I360" ]; then
                sed -i '/i360\./d' "$HOOK"
            fi
        fi
    fi
}

if [ "$CMD" == "--native" ]; then
    get_native_version
    exit
fi

if [ "$CMD" == "--install-i360" ]; then
    exit
fi

if [ "$CMD" == "--remove-i360" ]; then
    remove_i360
    exit
fi

if [ "$CMD" == "--install-hook" ]; then
    exit
fi

if [ "$CMD" == "--remove-hook" ]; then
    remove_hook
    exit
fi


echo "$0 [OPTION]"
echo "Utility for installing imunify360-php-i360 extension only for native EasyApache3 PHP"
echo "--native - show native php version"
echo "--remove-i360 - uninstall i360 extension for current native php"
echo "--remove-hook - uninstall hook for installation i360 extension on apache rebuild"
echo "--help - show this help"


Zerion Mini Shell 1.0