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


PHP DatabaseBase::ignoreErrors方法代码示例

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


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

示例1: tearDown

 protected function tearDown()
 {
     wfProfileIn(__METHOD__);
     // Cleaning up temporary files
     foreach ($this->tmpfiles as $fname) {
         if (is_file($fname) || is_link($fname)) {
             unlink($fname);
         } elseif (is_dir($fname)) {
             wfRecursiveRemoveDir($fname);
         }
     }
     if ($this->needsDB() && $this->db) {
         // Clean up open transactions
         while ($this->db->trxLevel() > 0) {
             $this->db->rollback();
         }
         // don't ignore DB errors
         $this->db->ignoreErrors(false);
     }
     // Restore mw globals
     foreach ($this->mwGlobals as $key => $value) {
         $GLOBALS[$key] = $value;
     }
     $this->mwGlobals = array();
     $phpErrorLevel = intval(ini_get('error_reporting'));
     if ($phpErrorLevel !== $this->phpErrorLevel) {
         ini_set('error_reporting', $this->phpErrorLevel);
         $oldHex = strtoupper(dechex($this->phpErrorLevel));
         $newHex = strtoupper(dechex($phpErrorLevel));
         $message = "PHP error_reporting setting was left dirty: was 0x{$oldHex} before test, 0x{$newHex} after test!";
         $this->fail($message);
     }
     parent::tearDown();
     wfProfileOut(__METHOD__);
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:35,代码来源:MediaWikiTestCase.php

示例2: tearDown

 protected function tearDown()
 {
     wfProfileIn(__METHOD__);
     // Cleaning up temporary files
     foreach ($this->tmpfiles as $fname) {
         if (is_file($fname) || is_link($fname)) {
             unlink($fname);
         } elseif (is_dir($fname)) {
             wfRecursiveRemoveDir($fname);
         }
     }
     if ($this->needsDB() && $this->db) {
         // Clean up open transactions
         while ($this->db->trxLevel() > 0) {
             $this->db->rollback();
         }
         // don't ignore DB errors
         $this->db->ignoreErrors(false);
     }
     // Restore mw globals
     foreach ($this->mwGlobals as $key => $value) {
         $GLOBALS[$key] = $value;
     }
     $this->mwGlobals = array();
     parent::tearDown();
     wfProfileOut(__METHOD__);
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:27,代码来源:MediaWikiTestCase.php

示例3: startWrite

 public function startWrite($code)
 {
     if ($this->readOnly) {
         return;
     }
     if (!$code) {
         throw new MWException(__METHOD__ . ": Invalid language \"{$code}\"");
     }
     $this->dbw = wfGetDB(DB_MASTER);
     try {
         $this->dbw->begin(__METHOD__);
         $this->dbw->delete('l10n_cache', array('lc_lang' => $code), __METHOD__);
     } catch (DBQueryError $e) {
         if ($this->dbw->wasReadOnlyError()) {
             $this->readOnly = true;
             $this->dbw->rollback(__METHOD__);
             $this->dbw->ignoreErrors(false);
             return;
         } else {
             throw $e;
         }
     }
     $this->currentLang = $code;
     $this->batch = array();
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:25,代码来源:LocalisationCache.php


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