From: Aaron Schulz Date: Thu, 21 Aug 2014 16:58:03 +0000 (-0700) Subject: Fixed bogus mysql error code 0 on mid-transaction disconnect X-Git-Tag: 1.31.0-rc.0~14324^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=9d03f95894164ac489c5f5fa2e540fc58637cd84;p=lhc%2Fweb%2Fwiklou.git Fixed bogus mysql error code 0 on mid-transaction disconnect * Now the proper error (e.g. "server has gone away") and code is shown. Change-Id: If0255101151441c7d05141ffc7cb416ad79e6bd8 --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 62d64eb35c..65ae444e87 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1130,7 +1130,9 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { $this->mTrxIdleCallbacks = array(); // bug 65263 $this->mTrxPreCommitCallbacks = array(); // bug 65263 wfDebug( "Connection lost, reconnecting...\n" ); - + # Stash the last error values since ping() might clear them + $lastError = $this->lastError(); + $lastErrno = $this->lastErrno(); if ( $this->ping() ) { global $wgRequestTime; wfDebug( "Reconnected\n" ); @@ -1145,6 +1147,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { if ( $hadTrx ) { # Leave $ret as false and let an error be reported. # Callers may catch the exception and continue to use the DB. + $this->reportQueryError( $lastError, $lastErrno, $sql, $fname, $tempIgnore ); } else { # Should be safe to silently retry (no trx and thus no callbacks) $ret = $this->doQuery( $commentedSql );