File: //usr/local/mailchannels/hooks/PostDomainPark.php
<?php
namespace MailChannels;
class PostDomainPark extends PostAccountsCreate {
public function execute($hookData) {
if (!isset($hookData['data']) || !isset($hookData['data']['new_domain'])) {
return array(false, "required elements in parameters are not present ([data][domain] and / or [data][new_domain]");
}
$domainName = $hookData["data"]["new_domain"];
$isInboundEnabled = $this->inboundEnabled();
$isAutoProtectionEnabled = $this->inboundConfig->isAutomaticDomainProtectionEnabled();
$processParkedAndAddonDomains = $this->inboundConfig->processParkedAndAddonDomains();
if ($isInboundEnabled && $isAutoProtectionEnabled && $processParkedAndAddonDomains) {
$p = popen("at now +1 minute", "w");
$cmd = "/usr/local/mailchannels/bin/inboundProvision.php {$domainName}";
fwrite($p, "$cmd");
pclose($p);
return array(true, "provisioning {$domainName} will take place in one minute");
}
$message = "no action taken; inbound enabled: $isInboundEnabled, automaticDomainProtectionEnabled: $isAutoProtectionEnabled, processParkedAndAddonDomains: $processParkedAndAddonDomains";
return array(true, $message);
}
public static function category() {
return 'Whostmgr';
}
public static function event() {
return 'Domain::park';
}
public static function stage() {
return 'post';
}
}