當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。