I'm trying to follow this documentation: Guide to Standardized Hooks - The describe() Method - Developer Documentation - cPanel Documentation
I've added a file with the following contents (just the example from the article):
How would I register this hook?
I need it to run on Accounts::Create (add()) and Accounts::Remove (remove())
I've added a file with the following contents (just the example from the article):
PHP:
#!/usr/local/cpanel/3rdparty/bin/php -q
<?php
// file - /var/cpanel/myapp/whm.php
// Any switches passed to this script
$switches = (count($argv) > 1) ? $argv : array();
// Argument evaluation.
if (in_array('--describe', $switches)) {
echo json_encode( describe() );
exit;
} elseif (in_array('--add', $switches)) {
list($status, $msg) = add();
echo "$status $msg";
exit;
} elseif (in_array('--remove', $switches)) {
list($status, $msg) = remove();
echo "$status $msg";
exit;
} else {
echo '0 myapp/whm.php needs a valid switch';
exit(1);
}
// Embed hook attribute information.
function describe() {
$my_add = array(
'category' => 'Whostmgr',
'event' => 'Accounts::Create',
'stage' => 'post',
'hook' => '/var/cpanel/myapp/whm.php --add',
'exectype' => 'script',
);
$my_remove = array(
'blocking' => 1,
'category' => 'Whostmgr',
'event' => 'Accounts::Remove',
'stage' => 'pre',
'hook' => '/var/cpanel/myapp/whm.php --remove',
'exectype' => 'script',
);
return array($my_add, $my_remove);
}
function add() {
// Your actions go here.
}
function remove() {
// Your actions go here.
}
?>
I need it to run on Accounts::Create (add()) and Accounts::Remove (remove())