當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AphrontWriteGuard::isGuardActive方法代碼示例

本文整理匯總了PHP中AphrontWriteGuard::isGuardActive方法的典型用法代碼示例。如果您正苦於以下問題:PHP AphrontWriteGuard::isGuardActive方法的具體用法?PHP AphrontWriteGuard::isGuardActive怎麽用?PHP AphrontWriteGuard::isGuardActive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AphrontWriteGuard的用法示例。


在下文中一共展示了AphrontWriteGuard::isGuardActive方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: resetSetupState

 public static final function resetSetupState()
 {
     $cache = PhabricatorCaches::getSetupCache();
     $cache->deleteKey('phabricator.setup.issue-keys');
     $server_cache = PhabricatorCaches::getServerStateCache();
     $server_cache->deleteKey('phabricator.in-flight');
     $use_scope = AphrontWriteGuard::isGuardActive();
     if ($use_scope) {
         $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     } else {
         AphrontWriteGuard::allowDangerousUnguardedWrites(true);
     }
     $caught = null;
     try {
         $db_cache = new PhabricatorKeyValueDatabaseCache();
         $db_cache->deleteKey('phabricator.setup.issue-keys');
     } catch (Exception $ex) {
         $caught = $ex;
     }
     if ($use_scope) {
         unset($unguarded);
     } else {
         AphrontWriteGuard::allowDangerousUnguardedWrites(false);
     }
     if ($caught) {
         throw $caught;
     }
 }
開發者ID:NeoArmageddon,項目名稱:phabricator,代碼行數:28,代碼來源:PhabricatorSetupCheck.php

示例2: stopProfiler

 public static function stopProfiler()
 {
     if (self::$profilerStarted) {
         $data = xhprof_disable();
         $data = serialize($data);
         $file_class = 'PhabricatorFile';
         // Since these happen on GET we can't do guarded writes. These also
         // sometimes happen after we've disposed of the write guard; in this
         // case we need to disable the whole mechanism.
         $use_scope = AphrontWriteGuard::isGuardActive();
         if ($use_scope) {
             $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
         } else {
             AphrontWriteGuard::allowDangerousUnguardedWrites(true);
         }
         $caught = null;
         try {
             $file = call_user_func(array($file_class, 'newFromFileData'), $data, array('mime-type' => 'application/xhprof', 'name' => 'profile.xhprof'));
         } catch (Exception $ex) {
             $caught = $ex;
         }
         if ($use_scope) {
             unset($unguarded);
         } else {
             AphrontWriteGuard::allowDangerousUnguardedWrites(false);
         }
         if ($caught) {
             throw $caught;
         } else {
             return $file->getPHID();
         }
     } else {
         return null;
     }
 }
開發者ID:nexeck,項目名稱:phabricator,代碼行數:35,代碼來源:DarkConsoleXHProfPluginAPI.php

示例3: saveEvents

 public function saveEvents()
 {
     if (!$this->isActive()) {
         return;
     }
     $events = $this->events;
     if (!$events) {
         return;
     }
     if ($this->sampleRate === null) {
         throw new PhutilInvalidStateException('setSampleRate');
     }
     $this->addServiceEvents();
     // Don't sample any of this stuff.
     $this->pauseMultimeter();
     $use_scope = AphrontWriteGuard::isGuardActive();
     if ($use_scope) {
         $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     } else {
         AphrontWriteGuard::allowDangerousUnguardedWrites(true);
     }
     $caught = null;
     try {
         $this->writeEvents();
     } catch (Exception $ex) {
         $caught = $ex;
     }
     if ($use_scope) {
         unset($unguarded);
     } else {
         AphrontWriteGuard::allowDangerousUnguardedWrites(false);
     }
     $this->unpauseMultimeter();
     if ($caught) {
         throw $caught;
     }
 }
開發者ID:rchicoli,項目名稱:phabricator,代碼行數:37,代碼來源:MultimeterControl.php

示例4: handleEvent

 public function handleEvent(PhutilEvent $event)
 {
     if (AphrontWriteGuard::isGuardActive()) {
         AphrontWriteGuard::getInstance()->disposeAbruptly();
     }
 }
開發者ID:lsubra,項目名稱:libphutil,代碼行數:6,代碼來源:AphrontWriteGuardExitEventListener.php


注:本文中的AphrontWriteGuard::isGuardActive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。