r44431 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44430‎ | r44431 | r44432 >
Date:23:15, 10 December 2008
Author:werdna
Status:deferred
Tags:
Comment:
Configure extension: With DB handler, defer wfConfigureSetup() to a new hook, SetupAfterCache, which, as the name implies, is executed in Setup.php, after caches are initialised.
This avoids some weird issues with Configure and maintenance scripts.
Modified paths:
  • /trunk/extensions/Configure/Configure.func.php (modified) (history)
  • /trunk/phase3/includes/Setup.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Setup.php
@@ -209,6 +209,10 @@
210210 "\nParser cache: " . get_class( $parserMemc ) . "\n" );
211211
212212 wfProfileOut( $fname.'-memcached' );
 213+
 214+## Most of the config is out, some might want to run hooks here.
 215+wfRunHooks( 'SetupAfterCache' );
 216+
213217 wfProfileIn( $fname.'-SetupSession' );
214218
215219 # Set default shared prefix
Index: trunk/extensions/Configure/Configure.func.php
@@ -50,8 +50,16 @@
5151 *
5252 * @param $wiki String
5353 */
54 -function efConfigureSetup( $wiki = 'default' ) {
 54+function efConfigureSetup( $wiki = 'default', $afterCache = false ) {
5555 global $wgConf, $wgConfigureFilesPath;
 56+
 57+ global $wgConfigureHandler;
 58+ if (!$afterCache && $wgConfigureHandler == 'db') {
 59+ // Defer to after caches are set up.
 60+ global $wgHooks;
 61+ $wgHooks['SetupAfterCache'][] = array( 'efConfigureSetupAfterCache', $wiki );
 62+ return;
 63+ }
5664
5765 # Create the new configuration object...
5866 $oldConf = $wgConf;
@@ -71,6 +79,11 @@
7280 $wgConf->extract();
7381 }
7482
 83+function efConfigureSetupAfterCache( $wiki ) {
 84+ efConfigureSetup( $wiki, true );
 85+ return true;
 86+}
 87+
7588 /**
7689 * Declare the API module only if $wgConfigureAPI is true
7790 */

Status & tagging log