当前位置: 首页>>代码示例>>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;未经允许,请勿转载。