Exemplo n.º 1
0
 /**
  * @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);
 }
Exemplo n.º 2
0
 /**
  * @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;
 }
Exemplo n.º 3
0
 /**
  * @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;
 }