From 84d86f31167ee62a4006504f3270630b3b4c5206 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Sat, 23 Oct 2010 11:16:44 +0000 Subject: [PATCH] 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. --- includes/BacklinkCache.php | 8 ++++++++ includes/db/DatabaseSqlite.php | 10 ---------- 2 files changed, 8 insertions(+), 10 deletions(-) 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'; } -- 2.20.1