Last active
January 14, 2016 19:32
-
-
Save cpCharlesBoyd/5196811 to your computer and use it in GitHub Desktop.
An example of using cPanel standardized hooks that executes when an addon domain is created.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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