Пример #1
0
 /**
  * Save domain details back to the database upon modifying the object. 
  * 
  * @param CDomain $oDomain
  *
  * @return bool
  */
 public function updateDomain(CDomain $oDomain)
 {
     $bResult = false;
     try {
         if ($oDomain->validate()) {
             if ($oDomain->IsDefaultDomain) {
                 $oSettings =& CApi::GetSettings();
                 $aSettingsMap = $oDomain->GetSettingsMap();
                 foreach ($aSettingsMap as $sProperty => $sSettingsName) {
                     $oSettings->SetConf($sSettingsName, $oDomain->{$sProperty});
                 }
                 $bResult = $oSettings->SaveToXml();
             } else {
                 if (!$this->oStorage->updateDomain($oDomain)) {
                     throw new CApiManagerException(Errs::DomainsManager_DomainUpdateFailed);
                 }
                 $bResult = true;
             }
         }
     } catch (CApiBaseException $oException) {
         $bResult = false;
         $this->setLastException($oException);
     }
     return $bResult;
 }