function getText() { global $wgShowDBErrorBacktrace; if ($this->useMessageCache()) { $s = wfMsg('dberrortextcl', htmlspecialchars($this->getSQL()), htmlspecialchars($this->fname), $this->errno, htmlspecialchars($this->error)) . "\n"; if ($wgShowDBErrorBacktrace) { $s .= "Backtrace:\n" . $this->getTraceAsString() . "\n"; } return $s; } else { return parent::getText(); } }
function __construct(Database &$db, $error, $errno, $sql, $fname) { $message = "A database error has occurred\n" . "Query: {$sql}\n" . "Function: {$fname}\n" . "Error: {$errno} {$error}\n"; parent::__construct($db, $message); $this->error = $error; $this->errno = $errno; $this->sql = $sql; $this->fname = $fname; }
/** * @param $html string * @return string */ function getContentMessage($html) { if ($this->useMessageCache()) { if ($html) { $msg = 'dberrortext'; $sql = htmlspecialchars($this->getSQL()); $fname = htmlspecialchars($this->fname); $error = htmlspecialchars($this->error); } else { $msg = 'dberrortextcl'; $sql = $this->getSQL(); $fname = $this->fname; $error = $this->error; } return wfMessage($msg)->rawParams($sql, $fname, $this->errno, $error)->text(); } else { return parent::getContentMessage($html); } }
public function __construct($sql) { $this->sql = $sql; parent::__construct($sql); }
function __construct(IDatabase $db = null, $error, array $params = []) { parent::__construct($db, $error); $this->params = $params; }
/** * @param DatabaseBase $db * @param string $error * @param int|string $errno * @param string $sql * @param string $fname */ function __construct(DatabaseBase $db, $error, $errno, $sql, $fname) { $message = "A database error has occurred. Did you forget to run " . "maintenance/update.php after upgrading? See: " . "https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script\n" . "Query: {$sql}\n" . "Function: {$fname}\n" . "Error: {$errno} {$error}\n"; parent::__construct($db, $message); $this->error = $error; $this->errno = $errno; $this->sql = $sql; $this->fname = $fname; }
/** * Handle a DBQueryError which occurred during a write operation. */ protected function handleWriteError(DBError $exception) { if ($exception instanceof DBConnectionError) { $this->connFailureTime = time(); $this->connFailureError = $exception; } if ($this->db && $this->db->wasReadOnlyError()) { try { $this->db->rollback(__METHOD__); } catch (DBError $e) { } } wfDebugLog('SQLBagOStuff', "DBError: {$exception->getMessage()}"); if ($this->db) { wfDebug(__METHOD__ . ": ignoring query error\n"); } else { wfDebug(__METHOD__ . ": ignoring connection error\n"); } }