From: Markus Glaser Date: Sat, 24 Sep 2011 20:07:21 +0000 (+0000) Subject: * restore DB connection after unserialization. This is needed in all DB variants... X-Git-Tag: 1.31.0-rc.0~27444 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=7100f75da8cbdd00b4d94a7e7be0d2ba75a1968c;p=lhc%2Fweb%2Fwiklou.git * 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. --- 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