From 9a4c60e5d9efbb99f8e1bbc798c812cbdcd7b8be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Mon, 19 Sep 2011 11:21:59 +0000 Subject: [PATCH] Committing another live hack for which I'm tired of getting conflicts. Basically I'm overriding wfWikiID to run multiple instances on same database but with different settings, and I don't want to them mess each others caches. --- includes/DefaultSettings.php | 8 ++++++++ includes/GlobalFunctions.php | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index b9a6776c56..207a63d627 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4158,6 +4158,14 @@ $wgParserTestFiles = array( */ $wgParserTestRemote = false; + +/** + * Overwrite the caching key prefix with custom value. Do not set if using + * load balancer, since it depends on the key being in certain format. + * @since 1.19 + */ +$wgWikiID = false; + /** @} */ # end of profiling, testing and debugging } /************************************************************************//** diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 4a722b5865..bdf0840c67 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -3148,8 +3148,10 @@ function wfForeignMemcKey( $db, $prefix /*, ... */ ) { * @return String */ function wfWikiID() { - global $wgDBprefix, $wgDBname; - if ( $wgDBprefix ) { + global $wgDBprefix, $wgDBname, $wgWikiID; + if ( $wgWikiID !== false ) { + return $wgWikiID; + } elseif ( $wgDBprefix ) { return "$wgDBname-$wgDBprefix"; } else { return $wgDBname; -- 2.20.1