if ( !$success ) {
$this->reportConnectionError();
- $this->close();
}
$this->mOpened = $success;
return $success;
/**
* @access private
* @param string $msg error message ?
- * @todo parameter $msg is not used
*/
- function reportConnectionError( $msg = '') {
+ function reportConnectionError() {
if ( $this->mFailFunction ) {
if ( !is_int( $this->mFailFunction ) ) {
$ff = $this->mFailFunction;
$ff( $this, $this->lastError() );
}
} else {
- wfEmergencyAbort( $this, mysql_error() );
+ wfEmergencyAbort( $this, $this->lastError() );
}
}
*/
function lastError() {
if ( $this->mConn ) {
+ # Even if it's non-zero, it can still be invalid
+ wfSuppressWarnings();
$error = mysql_error( $this->mConn );
+ if ( !$error ) {
+ $error = mysql_error();
+ }
+ wfRestoreWarnings();
} else {
$error = mysql_error();
}
*/
function wfEmergencyAbort( &$conn, $error ) {
global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding, $wgOutputEncoding;
- global $wgSitename, $wgServer;
+ global $wgSitename, $wgServer, $wgMessageCache;
# I give up, Brion is right. Getting the message cache to work when there is no DB is tricky.
# Hard coding strings instead.
header( 'Cache-control: none' );
header( 'Pragma: nocache' );
}
+
+ # No database access
+ $wgMessageCache->disable();
+
$msg = wfGetSiteNotice();
if($msg == '') {
$msg = str_replace( '$1', $error, $noconnect );