HEX
Server: LiteSpeed
System: Linux atali.colombiahosting.com.co 5.14.0-570.12.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 13 06:11:55 EDT 2025 x86_64
User: coopserp (1713)
PHP: 8.2.29
Disabled: dl,exec,passthru,proc_open,proc_close,shell_exec,memory_limit,system,popen,curl_multi_exec,show_source,symlink,link,leak,listen,diskfreespace,tmpfile,ignore_user_abord,highlight_file,source,show_source,fpaththru,virtual,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setid,posix_times,posix_ttyname,posix_uname,proc_get_status,proc_nice,proc_terminate
Upload Files
File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/clcommon/public_hooks/README.md
#Description

All hooks in the new system are grouped by objects that this event affects.
Those, create one hook to change a domain (any!), another to change a user.
Each hook must have a formal description of the available methods that you can subscribe to.

Example:

    class ModifyUserHook(object):
        HOOK_VERSION = 1

        @hook_method
        def pre_create_user(self, username, owner, **kwargs):
            pass

        @hook_method
        def post_create_user(self, username, owner, **kwargs):
            pass

        @hook_method
        def pre_rename_user(self, username, new_name, **kwargs):
            pass

        @hook_method
        def post_rename_user(self, username, new_name, **kwargs):
            pass

It is proposed to form methods according to the template:

    def [post|pre]_(action)_(object)(self, arg1, arg2, **kwargs):

To create a new panel event listener, you need to create a .py file
in the folder `/usr/share/cloudlinux/hooks/listeners/`.
In that file, you should create class that inherits from one (or several!)
of universal hooks, and the required methods must be redefined.

    #!/opt/cloudlinux/venv/bin/python3
    # coding=utf-8
    import subprocess
    import sys

    from clcommon.public_hooks.lib import ModifyUserHook, ModifyDomainHook


    class SyncMapHook(ModifyUserHook, ModifyDomainHook):

        @staticmethod
        def call_sync_map():
            # no matter

        def post_create_user(self, username, owner, **kwargs):
            self.call_sync_map()

        def post_delete_user(self, username, **kwargs):
            self.call_sync_map()

        def post_transit_user(self, username, new_name, **kwargs):
            self.call_sync_map()

In the example above, we subscribe to three events:
- post_create_user;
- post_delete_user;
- post_transit_user.

See detailed description in userland docs.