Hello,
I am attempting to hook Api2::AddonDomains::addaddondomain using a Perl module. I have the hook registered, but it seems it's being skipped when an addon is created. Essentially, what I'm trying to do is make an alternate form of commondomains. I need to specifically block a domain, but allow subdomains of it (for example, block somedomain.com but allow something.somedomain.com).
Here is what I'm seeing in /usr/local/cpanel/logs/error_log when an addon is created:
I know it's registering properly, so I'm not sure what's going on.
I am attempting to hook Api2::AddonDomains::addaddondomain using a Perl module. I have the hook registered, but it seems it's being skipped when an addon is created. Essentially, what I'm trying to do is make an alternate form of commondomains. I need to specifically block a domain, but allow subdomains of it (for example, block somedomain.com but allow something.somedomain.com).
Here is what I'm seeing in /usr/local/cpanel/logs/error_log when an addon is created:
To get it working, I currently have it so it will just fail and display the domain being added, but it's not even doing that.Cpanel::Park::_park('td2.com', 'td2', undef) called at /usr/local/cpanel/Cpanel/AddonDomain.pm line 87
Cpanel::AddonDomain::api2_addaddondomain(__CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__) called at /usr/local/cpanel/Cpanel/Api2/Exec.pm line 117
Cpanel::Api2::Exec::api2_exec('AddonDomain', 'addaddondomain', HASH(0xb60c6b0), HASH(0x295ebf0)) called at cpanel line 994
main::real_cpexectag('<?cp AddonDomain::addaddondomain(\'% %\',result,reason) newdomain=$FORM{\'domain\'},dir=$FORM{\'dir\'},subdomain=$FORM{\'user\'},pass=$FORM{\'pass\'} ?>') called at cpanel line 4214
Code:
package Arv::Domains;
use strict;
use warnings;
sub addon {
my ( $context, $data) = @_;
my $args = $data->{'args'};
my $domain = $args->{'newdomain'};
return 0,"$domain";
}
sub describe {
my $hook = [
{
'namespace' => 'Cpanel',
'function' => 'Api2::AddonDomain::addaddondomain',
'stage' => 'pre',
'hook' => 'Arv::Domains::addon',
},
];
return $hook;
}
1;
dev1:/root# /usr/local/cpanel/bin/manage_hooks add module Arv::Domains
Added hook for Cpanel::Api2::AddonDomain::addaddondomain to hooks registry