http://www.mediawiki.org/wiki/Special:Code/MediaWiki/98020

Revision: 98020
Author:   mglaser
Date:     2011-09-24 20:07:21 +0000 (Sat, 24 Sep 2011)
Log Message:
-----------
* 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.

Modified Paths:
--------------
    trunk/phase3/includes/db/Database.php

Modified: trunk/phase3/includes/db/Database.php
===================================================================
--- trunk/phase3/includes/db/Database.php       2011-09-24 20:01:50 UTC (rev 
98019)
+++ trunk/phase3/includes/db/Database.php       2011-09-24 20:07:21 UTC (rev 
98020)
@@ -608,6 +608,17 @@
                }
        }
 
+       /**
+        * 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


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to