当前位置: 首页>>代码示例>>PHP>>正文


PHP AphrontWriteGuard::allowDangerousUnguardedWrites方法代码示例

本文整理汇总了PHP中AphrontWriteGuard::allowDangerousUnguardedWrites方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontWriteGuard::allowDangerousUnguardedWrites方法的具体用法?PHP AphrontWriteGuard::allowDangerousUnguardedWrites怎么用?PHP AphrontWriteGuard::allowDangerousUnguardedWrites使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AphrontWriteGuard的用法示例。


在下文中一共展示了AphrontWriteGuard::allowDangerousUnguardedWrites方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: willRun

 protected function willRun()
 {
     parent::willRun();
     // This stores unbounded amounts of log data; make it discard instead so
     // that daemons do not require unbounded amounts of memory.
     DarkConsoleErrorLogPluginAPI::enableDiscardMode();
     $phabricator = phutil_get_library_root('phabricator');
     $root = dirname($phabricator);
     require_once $root . '/scripts/__init_env__.php';
     // Daemons may perform writes.
     AphrontWriteGuard::allowDangerousUnguardedWrites(true);
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:12,代码来源:PhabricatorDaemon.php

示例2: initializeScriptEnvironment

 public static function initializeScriptEnvironment()
 {
     self::initializeCommonEnvironment();
     // NOTE: This is dangerous in general, but we know we're in a script context
     // and are not vulnerable to CSRF.
     AphrontWriteGuard::allowDangerousUnguardedWrites(true);
     // There are several places where we log information (about errors, events,
     // service calls, etc.) for analysis via DarkConsole or similar. These are
     // useful for web requests, but grow unboundedly in long-running scripts and
     // daemons. Discard data as it arrives in these cases.
     PhutilServiceProfiler::getInstance()->enableDiscardMode();
     DarkConsoleErrorLogPluginAPI::enableDiscardMode();
     DarkConsoleEventPluginAPI::enableDiscardMode();
 }
开发者ID:JohnnyEstilles,项目名称:phabricator,代码行数:14,代码来源:PhabricatorEnv.php

示例3: error_reporting

 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
$include_path = ini_get('include_path');
ini_set('include_path', $include_path . PATH_SEPARATOR . dirname(__FILE__) . '/../../');
@(include_once 'libphutil/scripts/__init_script__.php');
if (!@constant('__LIBPHUTIL__')) {
    echo "ERROR: Unable to load libphutil. Update your PHP 'include_path' to " . "include the parent directory of libphutil/.\n";
    exit(1);
}
phutil_load_library(dirname(__FILE__) . '/../src/');
// NOTE: This is dangerous in general, but we know we're in a script context and
// are not vulnerable to CSRF.
AphrontWriteGuard::allowDangerousUnguardedWrites(true);
require_once dirname(dirname(__FILE__)) . '/conf/__init_conf__.php';
$env = isset($_SERVER['PHABRICATOR_ENV']) ? $_SERVER['PHABRICATOR_ENV'] : getenv('PHABRICATOR_ENV');
if (!$env) {
    echo phutil_console_wrap(phutil_console_format("**ERROR**: PHABRICATOR_ENV Not Set\n\n" . "Define the __PHABRICATOR_ENV__ environment variable before running " . "this script. You can do it on the command line like this:\n\n" . "  \$ PHABRICATOR_ENV=__custom/myconfig__ %s ...\n\n" . "Replace __custom/myconfig__ with the path to your configuration file. " . "For more information, see the 'Configuration Guide' in the " . "Phabricator documentation.\n\n", $argv[0]));
    exit(1);
}
$conf = phabricator_read_config_file($env);
$conf['phabricator.env'] = $env;
PhabricatorEnv::setEnvConfig($conf);
phutil_load_library('arcanist/src');
foreach (PhabricatorEnv::getEnvConfig('load-libraries') as $library) {
    phutil_load_library($library);
}
PhutilErrorHandler::initialize();
PhabricatorEventEngine::initialize();
开发者ID:nexeck,项目名称:phabricator,代码行数:31,代码来源:__init_script__.php

示例4: 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

示例5: stopProfiler

 private static function stopProfiler()
 {
     $data = xhprof_disable();
     $data = @json_encode($data);
     self::$profilerRunning = false;
     // 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('PhabricatorFile', '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;
     }
     self::$profileFilePHID = $file->getPHID();
 }
开发者ID:pugong,项目名称:phabricator,代码行数:30,代码来源:DarkConsoleXHProfPluginAPI.php

示例6: 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


注:本文中的AphrontWriteGuard::allowDangerousUnguardedWrites方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。