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


PHP AphrontWriteGuard::willWrite方法代码示例

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


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

示例1: deleteFile

 /**
  * Deletes the file from local disk, if it exists.
  * @task impl
  */
 public function deleteFile($handle)
 {
     $path = $this->getLocalDiskFileStorageFullPath($handle);
     if (Filesystem::pathExists($path)) {
         AphrontWriteGuard::willWrite();
         Filesystem::remove($path);
     }
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:12,代码来源:PhabricatorLocalDiskFileStorageEngine.php

示例2: deleteFile

 /**
  * Delete a blob from Amazon S3.
  */
 public function deleteFile($handle)
 {
     AphrontWriteGuard::willWrite();
     $s3 = $this->newS3API();
     $profiler = PhutilServiceProfiler::getInstance();
     $call_id = $profiler->beginServiceCall(array('type' => 's3', 'method' => 'deleteObject'));
     $s3->deleteObject($this->getBucketName(), $handle);
     $profiler->endServiceCall($call_id, array());
 }
开发者ID:denghp,项目名称:phabricator,代码行数:12,代码来源:PhabricatorS3FileStorageEngine.php

示例3: deleteFile

 /**
  * Delete a blob from Amazon S3.
  */
 public function deleteFile($handle)
 {
     $s3 = $this->newS3API();
     AphrontWriteGuard::willWrite();
     $profiler = PhutilServiceProfiler::getInstance();
     $call_id = $profiler->beginServiceCall(array('type' => 's3', 'method' => 'deleteObject'));
     $s3->setParametersForDeleteObject($handle)->resolve();
     $profiler->endServiceCall($call_id, array());
 }
开发者ID:truSense,项目名称:phabricator,代码行数:12,代码来源:PhabricatorS3FileStorageEngine.php

示例4: checkWrite

 protected function checkWrite($raw_query)
 {
     // NOTE: The opening "(" allows queries in the form of:
     //
     //   (SELECT ...) UNION (SELECT ...)
     $is_write = !preg_match('/^[(]*(SELECT|SHOW|EXPLAIN)\\s/', $raw_query);
     if ($is_write) {
         AphrontWriteGuard::willWrite();
         return true;
     }
     return false;
 }
开发者ID:billtt,项目名称:libphutil,代码行数:12,代码来源:AphrontBaseMySQLDatabaseConnection.php

示例5: executeRawQuery

 public function executeRawQuery($raw_query)
 {
     $this->lastResult = null;
     $retries = max(1, PhabricatorEnv::getEnvConfig('mysql.connection-retries'));
     while ($retries--) {
         try {
             $this->requireConnection();
             // TODO: Do we need to include transactional statements here?
             $is_write = !preg_match('/^(SELECT|SHOW|EXPLAIN)\\s/', $raw_query);
             if ($is_write) {
                 AphrontWriteGuard::willWrite();
             }
             $start = microtime(true);
             $profiler = PhutilServiceProfiler::getInstance();
             $call_id = $profiler->beginServiceCall(array('type' => 'query', 'config' => $this->configuration, 'query' => $raw_query, 'write' => $is_write));
             $result = $this->rawQuery($raw_query);
             $profiler->endServiceCall($call_id, array());
             if ($this->nextError) {
                 $result = null;
             }
             if ($result) {
                 $this->lastResult = $result;
                 break;
             }
             $this->throwQueryException($this->connection);
         } catch (AphrontQueryConnectionLostException $ex) {
             if ($this->isInsideTransaction()) {
                 // Zero out the transaction state to prevent a second exception
                 // ("program exited with open transaction") from being thrown, since
                 // we're about to throw a more relevant/useful one instead.
                 $state = $this->getTransactionState();
                 while ($state->getDepth()) {
                     $state->decreaseDepth();
                 }
                 // We can't close the connection before this because
                 // isInsideTransaction() and getTransactionState() depend on the
                 // connection.
                 $this->closeConnection();
                 throw $ex;
             }
             $this->closeConnection();
             if (!$retries) {
                 throw $ex;
             }
             $class = get_class($ex);
             $message = $ex->getMessage();
             phlog("Retrying ({$retries}) after {$class}: {$message}");
         }
     }
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:50,代码来源:AphrontMySQLDatabaseConnectionBase.php

示例6: deleteFile

 public function deleteFile($handle)
 {
     AphrontWriteGuard::willWrite();
     unset(self::$storage[$handle]);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:5,代码来源:PhabricatorTestStorageEngine.php

示例7: deleteFile

 /**
  * Delete a blob from S3.
  * @task impl
  */
 public function deleteFile($handle)
 {
     AphrontWriteGuard::willWrite();
     $this->newS3API()->deleteObject($this->getBucketName(), $handle);
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:9,代码来源:PhabricatorS3FileStorageEngine.php

示例8: checkWrite

 protected function checkWrite($raw_query)
 {
     // NOTE: The opening "(" allows queries in the form of:
     //
     //   (SELECT ...) UNION (SELECT ...)
     $is_write = !preg_match('/^[(]*(SELECT|SHOW|EXPLAIN)\\s/', $raw_query);
     if ($is_write) {
         if ($this->getReadOnly()) {
             throw new Exception(pht('Attempting to issue a write query on a read-only ' . 'connection (to database "%s")!', $this->getConfiguration('database')));
         }
         AphrontWriteGuard::willWrite();
         return true;
     }
     return false;
 }
开发者ID:endlessm,项目名称:libphutil,代码行数:15,代码来源:AphrontBaseMySQLDatabaseConnection.php

示例9: executeRawQuery

 public function executeRawQuery($raw_query)
 {
     $this->lastResult = null;
     $retries = 3;
     while ($retries--) {
         try {
             $this->requireConnection();
             // TODO: Do we need to include transactional statements here?
             $is_write = !preg_match('/^(SELECT|SHOW|EXPLAIN)\\s/', $raw_query);
             if ($is_write) {
                 AphrontWriteGuard::willWrite();
             }
             $start = microtime(true);
             $profiler = PhutilServiceProfiler::getInstance();
             $call_id = $profiler->beginServiceCall(array('type' => 'query', 'config' => $this->configuration, 'query' => $raw_query, 'write' => $is_write));
             $result = @mysql_query($raw_query, $this->connection);
             $profiler->endServiceCall($call_id, array());
             if ($result) {
                 $this->lastResult = $result;
                 break;
             }
             $this->throwQueryException($this->connection);
         } catch (AphrontQueryConnectionLostException $ex) {
             if (!$retries) {
                 throw $ex;
             }
             if ($this->isInsideTransaction()) {
                 throw $ex;
             }
             $this->closeConnection();
         }
     }
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:33,代码来源:AphrontMySQLDatabaseConnection.php

示例10: checkWrite

 protected function checkWrite($raw_query)
 {
     $is_write = !preg_match('/^(SELECT|SHOW|EXPLAIN)\\s/', $raw_query);
     if ($is_write) {
         AphrontWriteGuard::willWrite();
         return true;
     }
     return false;
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:9,代码来源:AphrontMySQLDatabaseConnectionBase.php


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