/** * @param IDatabase $db Object throwing the error * @param string $error Error text */ function __construct(IDatabase $db = null, $error = 'unknown error') { $msg = 'Cannot access the database'; if (trim($error) != '') { $msg .= ": {$error}"; } parent::__construct($db, $msg); }
/** * @param IDatabase $db * @param string $error * @param int|string $errno * @param string $sql * @param string $fname */ function __construct(IDatabase $db, $error, $errno, $sql, $fname) { if ($db instanceof Database && $db->wasConnectionError($errno)) { $message = "A connection error occured. \n" . "Query: {$sql}\n" . "Function: {$fname}\n" . "Error: {$errno} {$error}\n"; } else { $message = "A database query error has occurred. Did you forget to run " . "your application's database schema updater after upgrading? \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 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; }