本文整理汇总了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__);
}
示例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__);
}
示例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();
}