From 7100f75da8cbdd00b4d94a7e7be0d2ba75a1968c Mon Sep 17 00:00:00 2001 From: Markus Glaser Date: Sat, 24 Sep 2011 20:07:21 +0000 Subject: [PATCH] * restore DB connection after unserialization. This is needed in all DB variants safe for MySQL. Found when running PagedTiffHandler Selenium tests on Postgres. Credits to Dan Nessett. --- includes/db/Database.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/db/Database.php b/includes/db/Database.php index 153443fcda..c4e4456ac8 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -608,6 +608,17 @@ abstract class DatabaseBase implements DatabaseType { } } + /** + * Called by unserialize. Needed to reopen DB connection, which + * is not saved by serialize. + */ + public function __wakeup() { + if ( $this->isOpen() ) { + $this->open( $this->mServer, $this->mUser, + $this->mPassword, $this->mDBname); + } + } + /** * Same as new DatabaseMysql( ... ), kept for backward compatibility * @deprecated since 1.17 -- 2.20.1