예제 #1
0
파일: cdn.php 프로젝트: DarneoStudio/bitrix
 /**
  *
  * @return void
  *
  */
 public static function domainChanged()
 {
     self::$domain_changed = true;
 }
예제 #2
0
 /**
  *
  * @param bool $bActive
  * @return bool
  *
  */
 public function SetActive($bActive)
 {
     /**
      * @global CMain $APPLICATION
      */
     global $APPLICATION;
     if ($bActive) {
         if (!self::IsActive()) {
             try {
                 $o = CBitrixCloudCDNConfig::getInstance()->loadRemoteXML();
                 $o->saveToOptions();
                 RegisterModuleDependences("main", "OnEndBufferContent", "bitrixcloud", "CBitrixCloudCDN", "OnEndBufferContent");
                 self::$domain_changed = false;
             } catch (exception $e) {
                 $ex = new CApplicationException($e->getMessage());
                 $APPLICATION->ThrowException($ex);
                 return false;
             }
         } elseif (self::$domain_changed) {
             try {
                 $o = CBitrixCloudCDNConfig::getInstance()->loadRemoteXML();
                 $o->saveToOptions();
                 self::$domain_changed = false;
             } catch (exception $e) {
                 $ex = new CApplicationException($e->getMessage());
                 $APPLICATION->ThrowException($ex);
                 return false;
             }
         }
     } else {
         if (self::IsActive()) {
             try {
                 self::stop();
                 UnRegisterModuleDependences("main", "OnEndBufferContent", "bitrixcloud", "CBitrixCloudCDN", "OnEndBufferContent");
             } catch (exception $e) {
                 UnRegisterModuleDependences("main", "OnEndBufferContent", "bitrixcloud", "CBitrixCloudCDN", "OnEndBufferContent");
                 $ex = new CApplicationException($e->getMessage());
                 $APPLICATION->ThrowException($ex);
                 return false;
             }
         }
     }
     return true;
 }