r44059 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44058‎ | r44059 | r44060 >
Date:09:44, 30 November 2008
Author:werdna
Status:ok (Comments)
Tags:
Comment:
Allow DB to be used during LocalSettings.php et al by changing plain get of global $wgMemc to wfGetMainCache(), which will load memcached if necessary.
Modified paths:
  • /trunk/phase3/includes/db/LoadMonitor.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/LoadMonitor.php
@@ -64,6 +64,9 @@
6565 $requestRate = 10;
6666
6767 global $wgMemc;
 68+ if ( empty( $wgMemc ) )
 69+ $wgMemc = wfGetMainCache();
 70+
6871 $masterName = $this->parent->getServerName( 0 );
6972 $memcKey = wfMemcKey( 'lag_times', $masterName );
7073 $times = $wgMemc->get( $memcKey );

Comments

#Comment by Aaron Schulz (talk | contribs)   06:15, 3 December 2008

What is this for?

#Comment by Werdna (talk | contribs)   06:18, 3 December 2008

If you try to hit the database before memcached is set up, this breaks here, because $wgMemc isn't set yet.

#Comment by Brion VIBBER (talk | contribs)   19:14, 10 December 2008

I'll be honest, this kind of creeps me out... if one thing hasn't been initialized yet, about about the bajillion other things that haven't been initialized? It just feels like you could end up in some cyclical dependencies doing stuff like this.

#Comment by Werdna (talk | contribs)   00:27, 11 December 2008

Note that the need for this in the Configure extension has been negated in r44431.

Status & tagging log