File: //usr/local/mailchannels/hooks/PostParkAdminUnPark.php
<?php
namespace MailChannels;
class PostParkAdminUnPark extends PostAccountsCreate {
public function execute($hookData) {
if ($this->inboundEnabled()) {
if (isset($hookData['data']) && isset($hookData['data']['domain'])) {
if ($this->inboundConfig->autoDomainDeProvisioning() && $this->inboundConfig->processParkedAndAddonDomains()) {
$domain = $hookData['data']['domain'];
try {
$deprovisionResult = $this->inboundSmtpService->deProvisionDomain($domain);
if ($deprovisionResult) {
return array(true, "domain $domain no longer uses MailChannels");
} else {
return array(true, "no action taken; domain $domain not found");
}
} catch (InboundSMTPServiceNotConfiguredException $e) {
$errorMessage = $e->getTraceAsString();
return array(false, "unexpected error unparking domain $domain: $errorMessage");
}
}
return array(true, "action not taken; automatic provisioning and parked and/or addon domain processing is not set");
}
return array(false, "could not find the domain in the hook data");
}
return array(true, "action not taken; inbound not enabled");
}
public static function category() {
return 'Whostmgr';
}
public static function event() {
return 'ParkAdmin::unpark';
}
public static function stage() {
return 'post';
}
}