#!/usr/bin/bash

# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT

. /opt/cloudlinux/venv/usr/share/python-cllib/scripts/cl-common
common_path="/usr/share/cagefs/cpanel"


if [ -e "/usr/local/cpanel/hooks/subdomain/addsubdomain" ]; then
	deleteAllInclude "/usr/local/cpanel/hooks/subdomain/addsubdomain" "addsubdomain" "/#CageFS/d" "$common_path"
fi

if [ -e "/usr/local/cpanel/hooks/subdomain/delsubdomain" ]; then
	deleteAllInclude "/usr/local/cpanel/hooks/subdomain/delsubdomain" "delsubdomain" "/#CageFS/d" "$common_path"
fi

if [ -e "/usr/local/cpanel/hooks/addondomain/addaddondomain" ]; then
	deleteAllInclude "/usr/local/cpanel/hooks/addondomain/addaddondomain" "addaddondomain" "/#CageFS/d" "$common_path"
fi

if [ -e "/usr/local/cpanel/hooks/addondomain/deladdondomain" ]; then
	deleteAllInclude "/usr/local/cpanel/hooks/addondomain/deladdondomain" "deladdondomain" "/#CageFS/d" "$common_path"
fi

if [ -e "/scripts/postkillacct" ]; then
    deleteAllInclude "/scripts/postkillacct" "postkillacct" "/#CageFS/d" "$common_path"
fi

if [ -e "/scripts/prekillacct" ]; then
    deleteAllInclude "/scripts/prekillacct" "prekillacct" "/#CageFS/d" "$common_path"
fi

if [ -e "/scripts/postmodifyacct" ]; then
    deleteAllInclude "/scripts/postmodifyacct" "postmodifyacct" "/#CageFS/d" "$common_path"
fi

if [ -e "/scripts/postwwwacct" ]; then
    deleteAllInclude "/scripts/postwwwacct" "postwwwacct" "/#CageFS/d" "$common_path"
fi

if [ -e "/scripts/postrestoreacct" ]; then
    deleteAllInclude "/scripts/postrestoreacct" "postrestoreacct" "/#CageFS/d" "$common_path"
fi

/usr/local/cpanel/bin/register_hooks
