Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example of using cPanel standardized hooks that executes when an addon domain is created.
#!/usr/bin/env perl
package YourAddonModule;
use warnings;
use strict;
sub describe {
my $create_addon_hook =
{
'category' => 'Cpanel',
'event' => 'Api2::AddonDomain::addaddondomain',
'stage' => 'pre', # or post
'hook' => 'YourAddonModule::your_hook_subroutine',
'exectype' => 'module',
};
return [$create_addon_hook];
}
sub your_addon_hook {
my ( $context, $data ) = @_;
my $args = $data->{'args'};
my ( $dir, $newdomain, $subdomain ) = ( $args->{'dir'}, $args->{'newdomain'}, $args->{'subdomain'} );
print "HOOK TEST : Created $newdomain with dir = $dir and subdomain = $subdomain","\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment