(bug 32853) DBA cache broken in MW 1.18
authorAntoine Musso <hashar@users.mediawiki.org>
Wed, 7 Dec 2011 11:04:11 +0000 (11:04 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Wed, 7 Dec 2011 11:04:11 +0000 (11:04 +0000)
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

includes/DefaultSettings.php
includes/objectcache/DBABagOStuff.php

index b62597f..1eefa55 100644 (file)
@@ -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' ),
index f5f7a7c..ade8c0a 100644 (file)
@@ -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;