r105419 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105418‎ | r105419 | r105420 >
Date:11:04, 7 December 2011
Author:hashar
Status:ok (Comments)
Tags:
Comment:
(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
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/objectcache/DBABagOStuff.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/objectcache/DBABagOStuff.php
@@ -6,20 +6,23 @@
77 * writer locks. Intended for development use only, as a memcached workalike
88 * for systems that don't have it.
99 *
 10+ * On construction you can pass array( 'dir' => '/some/path' ); as a parameter
 11+ * to override the default DBA files directory (wgTmpDirectory).
 12+ *
1013 * @ingroup Cache
1114 */
1215 class DBABagOStuff extends BagOStuff {
1316 var $mHandler, $mFile, $mReader, $mWriter, $mDisabled;
1417
15 - public function __construct( $dir = false ) {
 18+ public function __construct( $params ) {
1619 global $wgDBAhandler;
1720
18 - if ( $dir === false ) {
 21+ if ( !isset( $params['dir'] ) ) {
1922 global $wgTmpDirectory;
20 - $dir = $wgTmpDirectory;
 23+ $params['dir'] = $wgTmpDirectory;
2124 }
2225
23 - $this->mFile = "$dir/mw-cache-" . wfWikiID();
 26+ $this->mFile = $params['dir']."/mw-cache-" . wfWikiID();
2427 $this->mFile .= '.db';
2528 wfDebug( __CLASS__ . ": using cache file {$this->mFile}\n" );
2629 $this->mHandler = $wgDBAhandler;
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1529,6 +1529,8 @@
15301530 * given, giving a callable function which will generate a suitable cache object.
15311531 *
15321532 * The other parameters are dependent on the class used.
 1533+ * - CACHE_DBA uses $wgTmpDirectory by default. The 'dir' parameter let you
 1534+ * overrides that.
15331535 */
15341536 $wgObjectCaches = array(
15351537 CACHE_NONE => array( 'class' => 'EmptyBagOStuff' ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r105706MFT to REL1_18...hashar20:31, 9 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83140* Rewrote ObjectCache.php to conform to the modern coding style, and to be le...tstarling09:37, 3 March 2011

Comments

#Comment by Hashar (talk | contribs)   14:27, 7 December 2011

Need back port in REL1_18.

WMF does not use DBA.

#Comment by 😂 (talk | contribs)   15:22, 9 December 2011

Not worth backporting to REL1_18 imho, per the docs people shouldn't be using CACHE_DBA except in testing anyway.

#Comment by Hashar (talk | contribs)   21:32, 9 December 2011

Doh, I have merged it before reading your comment. Son now it is merged I have marked bug 32853 as solved.

Status & tagging log