X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdb%2FDatabaseError.php;h=6453854a7b3606fc32577532df67e635295d9e09;hb=938cdc3a59d95ab775672eb15d30b906a06759df;hp=8229c99565d01da97c313c8a954495299ecdfe9b;hpb=e50ef5784e237ce26c91ec402cb94669c78e303e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/db/DatabaseError.php b/includes/db/DatabaseError.php index 8229c99565..6453854a7b 100644 --- a/includes/db/DatabaseError.php +++ b/includes/db/DatabaseError.php @@ -168,12 +168,12 @@ class DBConnectionError extends DBExpectedError { if ( $wgShowHostnames || $wgShowSQLErrors ) { $info = str_replace( '$1', Html::element( 'span', array( 'dir' => 'ltr' ), $this->error ), - htmlspecialchars( $this->msg( 'dberr-info', '(Cannot contact the database server: $1)' ) ) + htmlspecialchars( $this->msg( 'dberr-info', '(Cannot access the database: $1)' ) ) ); } else { $info = htmlspecialchars( $this->msg( 'dberr-info-hidden', - '(Cannot contact the database server)' + '(Cannot access the database)' ) ); } @@ -229,7 +229,7 @@ class DBConnectionError extends DBExpectedError { return; } - } catch ( MWException $e ) { + } catch ( Exception $e ) { // Do nothing, just use the default page } } @@ -306,7 +306,7 @@ EOT; } } - $cache = HTMLFileCache::newFromTitle( $t, 'view' ); + $cache = new HTMLFileCache( $t, 'view' ); if ( $cache->isCached() ) { return $cache->fetchText(); } else { @@ -329,12 +329,19 @@ class DBQueryError extends DBExpectedError { * @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"; + if ( $db->wasConnectionError( $errno ) ) { + $message = "A connection error occured. \n" . + "Query: $sql\n" . + "Function: $fname\n" . + "Error: $errno $error\n"; + } else { + $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; @@ -444,3 +451,9 @@ This may indicate a bug in the software.', */ class DBUnexpectedError extends DBError { } + +/** + * @ingroup Database + */ +class DBReadOnlyError extends DBError { +}