buy
Hooks

Overview

Hooks enable the User to modify certain aspects of the task being done. There are some Hooks in Webuzo that you can take advantage of :

Hooks directory is located at :

/usr/local/webuzo/enduser/hooks/ 

pre_add_domain

  • This hook will be executed before a domain add process begin.
  • Rename the pre_add_domain.txt in the hooks folder to pre_add_domain.php and write your code.

post_add_domain

  • This hook will be executed immediately after a domain add process completed.
  • Rename the post_add_domain.txt in the hooks folder to post_add_domain.php and write your code.

pre_delete_domain

  • This hook will be executed before a delete domain process begin.
  • Rename the pre_delete_domain.txt in the hooks folder to pre_delete_domain.php and write your code.

post_delete_domain

  • This hook will be executed immediately after a delete domain process completed.
  • Rename the post_delete_domain.txt in the hooks folder to post_delete_domain.php and write your code.

Procedure

The following guide will show you how the User can configure hooks to customize the add and remove process of Domain.

  • SSH to your server and go to the following path:
/usr/local/webuzo/enduser/hooks/ 
  • You can see these files pre_add_domain.txt, post_add_domain.txt, pre_delete_domain.txt, post_delete_domain.txt,
  • Choose the file you would like to execute depending upon your requirement and rename it to make it a PHP file.
  • Add the code in the function available in the file and save the file.
  • That's it you have configured the hook.
  • For eg: You would like to make some changes related to Apache and you want to apply this change before every domain added on the server.
  • For this you will have to rename the file pre_add_domain.txt to pre_add_domain.php because the change is to be done before domain add and add the code in the function __pre_add_domain().
function __pre_add_domain($domain_name){
      global $iapps $globals;
      // Do stuff here
      // e.g. is for if you want to perform action only for apache
      if(!empty($iapps['3_1'])){
      /* Perform action only if Apache installed $iapps is a list of installed system applications */      
      } 
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list