X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdb%2FDatabaseMysqlBase.php;h=5f27dd78ccb9f353357f5e2bbf042c7f904191a6;hb=c63fde6797c2b6ba4b17ba0f9ca3197ed23f327f;hp=a18964803ffe84418fc34a0431f96226981e6336;hpb=f4770c54d4d92c4aeeaee89d2219fe242e8699bb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/db/DatabaseMysqlBase.php b/includes/db/DatabaseMysqlBase.php index a18964803f..5f27dd78cc 100644 --- a/includes/db/DatabaseMysqlBase.php +++ b/includes/db/DatabaseMysqlBase.php @@ -1058,6 +1058,28 @@ abstract class DatabaseMysqlBase extends DatabaseBase { ( $this->lastErrno() == 1290 && strpos( $this->lastError(), '--read-only' ) !== false ); } + /** + * Get the underlying binding handle, mConn + * + * Makes sure that mConn is set (disconnects and ping() failure can unset it). + * This catches broken callers than catch and ignore disconnection exceptions. + * Unlike checking isOpen(), this is safe to call inside of open(). + * + * @return resource|object + * @throws DBUnexpectedError + * @since 1.26 + */ + protected function getBindingHandle() { + if ( !$this->mConn ) { + throw new DBUnexpectedError( + $this, + 'DB connection was already closed or the connection dropped.' + ); + } + + return $this->mConn; + } + /** * @param string $oldName * @param string $newName