From: daniel Date: Thu, 31 Jan 2013 14:33:22 +0000 (+0100) Subject: Make Sites::singleton() actually return a singleton. X-Git-Tag: 1.31.0-rc.0~20850^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=1915b461e0f12e8273080f370a0223e5c79ba30e;p=lhc%2Fweb%2Fwiklou.git 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 --- 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; } /**