From: Antoine Musso Date: Wed, 7 Dec 2011 11:04:11 +0000 (+0000) Subject: (bug 32853) DBA cache broken in MW 1.18 X-Git-Tag: 1.31.0-rc.0~26144 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=f874649556d1db7cae8cc24d8f1973573d3ba67f;p=lhc%2Fweb%2Fwiklou.git (bug 32853) DBA cache broken in MW 1.18 DBABagOStuff was not refactored by r83140 which pass BagOStuff constructors an array. This patch honor the 'dir' parameter to let you override the global $wgTmpDirectory. Need backport in REL1_18 --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index b62597f15f..1eefa55d65 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1529,6 +1529,8 @@ $wgParserCacheType = CACHE_ANYTHING; * given, giving a callable function which will generate a suitable cache object. * * The other parameters are dependent on the class used. + * - CACHE_DBA uses $wgTmpDirectory by default. The 'dir' parameter let you + * overrides that. */ $wgObjectCaches = array( CACHE_NONE => array( 'class' => 'EmptyBagOStuff' ), diff --git a/includes/objectcache/DBABagOStuff.php b/includes/objectcache/DBABagOStuff.php index f5f7a7c8dc..ade8c0a9c7 100644 --- a/includes/objectcache/DBABagOStuff.php +++ b/includes/objectcache/DBABagOStuff.php @@ -6,20 +6,23 @@ * writer locks. Intended for development use only, as a memcached workalike * for systems that don't have it. * + * On construction you can pass array( 'dir' => '/some/path' ); as a parameter + * to override the default DBA files directory (wgTmpDirectory). + * * @ingroup Cache */ class DBABagOStuff extends BagOStuff { var $mHandler, $mFile, $mReader, $mWriter, $mDisabled; - public function __construct( $dir = false ) { + public function __construct( $params ) { global $wgDBAhandler; - if ( $dir === false ) { + if ( !isset( $params['dir'] ) ) { global $wgTmpDirectory; - $dir = $wgTmpDirectory; + $params['dir'] = $wgTmpDirectory; } - $this->mFile = "$dir/mw-cache-" . wfWikiID(); + $this->mFile = $params['dir']."/mw-cache-" . wfWikiID(); $this->mFile .= '.db'; wfDebug( __CLASS__ . ": using cache file {$this->mFile}\n" ); $this->mHandler = $wgDBAhandler;