/**
  * Farm launched
  *
  * @param bool $mark_instances_as_active
  */
 public function OnFarmLaunched(FarmLaunchedEvent $event)
 {
     //SYSTEM DNS RECORD
     if (CONFIG::$SYSDNS_SYSTEM) {
         try {
             $hash = DBFarm::LoadByID($event->GetFarmID())->Hash;
             $this->DB->Execute("INSERT INTO `powerdns`.`domains` SET `name`=?, `type`=?, `scalr_farm_id`=?", array("{$hash}.scalr-dns.net", 'NATIVE', $event->GetFarmID()));
         } catch (Exception $e) {
         }
     }
     $zones = DBDNSZone::loadByFarmId($event->GetFarmID());
     if (count($zones) == 0) {
         return;
     }
     foreach ($zones as $zone) {
         if ($zone->status == DNS_ZONE_STATUS::INACTIVE) {
             $zone->status = DNS_ZONE_STATUS::PENDING_CREATE;
             $zone->save();
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Farm launched
  *
  * @param bool $mark_instances_as_active
  */
 public function OnFarmLaunched(FarmLaunchedEvent $event)
 {
     //SYSTEM DNS RECORD
     if (\Scalr::config('scalr.dns.static.enabled')) {
         try {
             $hash = DBFarm::LoadByID($event->GetFarmID())->Hash;
             $pdnsDb = \Scalr::getContainer()->dnsdb;
             $pdnsDb->Execute("INSERT INTO `domains` SET `name`=?, `type`=?, `scalr_farm_id`=?", array("{$hash}.scalr-dns.net", 'NATIVE', $event->GetFarmID()));
         } catch (Exception $e) {
         }
     }
     $zones = DBDNSZone::loadByFarmId($event->GetFarmID());
     if (count($zones) == 0) {
         return;
     }
     foreach ($zones as $zone) {
         if ($zone->status == DNS_ZONE_STATUS::INACTIVE) {
             $zone->status = DNS_ZONE_STATUS::PENDING_CREATE;
             $zone->isZoneConfigModified = 1;
             $zone->save();
         }
     }
 }