public function worker($request)
{
if (!\Scalr::config('scalr.dns.global.enabled')) {
$this->getLogger()->error("Unable to process the request. scalr.dns.global.enabled = false");
return;
}
//Warming up static DI cache
\Scalr::getContainer()->warmup();
$DBDNSZone = DBDNSZone::loadById($request->id);
$remoteBind = new Scalr_Net_Dns_Bind_RemoteBind();
$transport = new Scalr_Net_Dns_Bind_Transports_LocalFs('/usr/sbin/rndc', '/var/named/etc/namedb/client_zones');
$remoteBind->setTransport($transport);
switch ($DBDNSZone->status) {
case DNS_ZONE_STATUS::PENDING_DELETE:
case DNS_ZONE_STATUS::INACTIVE:
$remoteBind->removeZoneDbFile($DBDNSZone->zoneName);
$DBDNSZone->isZoneConfigModified = 1;
break;
case DNS_ZONE_STATUS::PENDING_CREATE:
case DNS_ZONE_STATUS::PENDING_UPDATE:
$remoteBind->addZoneDbFile($DBDNSZone->zoneName, $DBDNSZone->getContents());
if ($DBDNSZone->status == DNS_ZONE_STATUS::PENDING_CREATE) {
$DBDNSZone->isZoneConfigModified = 1;
}
$DBDNSZone->status = DNS_ZONE_STATUS::ACTIVE;
break;
}
$DBDNSZone->save();
return $request;
}