From: Max Semenik Date: Sat, 23 Oct 2010 11:16:44 +0000 (+0000) Subject: Reverted r70151 and re-did what it was intended to do in a proper way: instead of... X-Git-Tag: 1.31.0-rc.0~34379 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=84d86f31167ee62a4006504f3270630b3b4c5206;p=lhc%2Fweb%2Fwiklou.git Reverted r70151 and re-did what it was intended to do in a proper way: instead of just quietly serializing a crippled connection, fix the caller and receive nice exceptions when something else is broken instead of bug-hunting later. --- diff --git a/includes/BacklinkCache.php b/includes/BacklinkCache.php index b23fd56bd5..02b0f170c5 100644 --- a/includes/BacklinkCache.php +++ b/includes/BacklinkCache.php @@ -21,6 +21,14 @@ class BacklinkCache { $this->title = $title; } + /** + * Serialization handler, diasallows to serialize the database to prevent + * failures after this class is deserialized from cache with dead DB connection. + */ + function __sleep() { + return array( 'partitionCache', 'fullResultCache', 'title' ); + } + /** * Clear locally stored data */ diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 3663d31d58..103744af03 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -34,16 +34,6 @@ class DatabaseSqlite extends DatabaseBase { } } - /** - * Serialization handler, see http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep - * for details. Instances of this class sometimes get serialized, e.g. with Title and its BacklinkCache - * Because attempts to serialize mConn end in "can't serialize PDO objects" exceptions, we simply disallow - * to serialize anything in this class. - */ - function __sleep() { - return array(); - } - function getType() { return 'sqlite'; }