follow-up to r98020. Throw MWException on attempt to serialize database.
authorMarkus Glaser <mglaser@users.mediawiki.org>
Sat, 15 Oct 2011 01:33:19 +0000 (01:33 +0000)
committerMarkus Glaser <mglaser@users.mediawiki.org>
Sat, 15 Oct 2011 01:33:19 +0000 (01:33 +0000)
includes/db/Database.php

index 239b430..003c4cb 100644 (file)
@@ -608,15 +608,13 @@ abstract class DatabaseBase implements DatabaseType {
                }
        }
 
-       /**
-        * Called by unserialize. Needed to reopen DB connection, which
-        * is not saved by serialize.
+       /**
+        * Called by serialize. Throw an exception when DB connection is serialized.
+        * This causes problems on some database engines because the connection is 
+        * not restored on unserialize.
         */
-       public function __wakeup() {
-        if ( $this->isOpen() ) {
-                       $this->open( $this->mServer, $this->mUser,
-                                    $this->mPassword, $this->mDBname);
-               }
+       public function __sleep() {
+               throw new MWException( 'Database serialization may cause problems, since the connection is not restored on wakeup.' );
        }
 
        /**