public function initDefault()
{
$this->createDefaultCostCenter();
//Assigns cost centre to each environment
$res = $this->db->Execute("SELECT id FROM client_environments");
while ($rec = $res->FetchRow()) {
try {
$environment = Scalr_Environment::init()->loadById($rec['id']);
} catch (Exception $e) {
continue;
}
$this->db->Execute("INSERT IGNORE account_ccs (account_id, cc_id) VALUES (?, UNHEX(?))", [$environment->clientId, str_replace('-', '', $this->autoCostCentre())]);
$environment->setPlatformConfig(array(Scalr_Environment::SETTING_CC_ID => $this->autoCostCentre()));
}
//Assigns project to each farm
$res = $this->db->Execute("SELECT id, env_id, clientid FROM farms");
while ($rec = $res->FetchRow()) {
try {
$dbFarm = DBFarm::LoadByID($rec['id']);
} catch (Exception $e) {
continue;
}
$dbFarm->SetSetting(Entity\FarmSetting::PROJECT_ID, $this->autoProject());
}
//Initializes servers properties
$this->initServerProperties();
}