From 1915b461e0f12e8273080f370a0223e5c79ba30e Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 31 Jan 2013 15:33:22 +0100 Subject: [PATCH] Make Sites::singleton() actually return a singleton. Sites::singleton() was returning a new instance for every call, rendering in-process caching ineffective. This was causing extreme slowness on some configurations (about factor 100). Change-Id: I1e28afea8710b44542c55db150ad37518a5a5df1 --- includes/site/SiteSQLStore.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/site/SiteSQLStore.php b/includes/site/SiteSQLStore.php index a79c8c5e5d..c46205736e 100644 --- a/includes/site/SiteSQLStore.php +++ b/includes/site/SiteSQLStore.php @@ -466,7 +466,13 @@ class Sites extends SiteSQLStore { * @return SiteStore */ public static function singleton() { - return new static(); + static $singleton; + + if ( $singleton === null ) { + $singleton = new static(); + } + + return $singleton; } /** -- 2.20.1