* restore DB connection after unserialization. This is needed in all DB variants...
authorMarkus Glaser <mglaser@users.mediawiki.org>
Sat, 24 Sep 2011 20:07:21 +0000 (20:07 +0000)
committerMarkus Glaser <mglaser@users.mediawiki.org>
Sat, 24 Sep 2011 20:07:21 +0000 (20:07 +0000)
includes/db/Database.php

index 153443f..c4e4456 100644 (file)
@@ -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