r72551 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72550‎ | r72551 | r72552 >
Date:20:45, 7 September 2010
Author:ialex
Status:ok
Tags:
Comment:
added Maintenance::afterFinalSetup() instead of having to define a callback with MW_CMDLINE_CALLBACK
Modified paths:
  • /trunk/phase3/maintenance/Maintenance.php (modified) (history)
  • /trunk/phase3/maintenance/update.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/update.php
@@ -9,7 +9,6 @@
1010 * @ingroup Maintenance
1111 */
1212
13 -define( 'MW_CMDLINE_CALLBACK', 'wfSetupUpdateScript' );
1413 $wgUseMasterForMaintenance = true;
1514 require_once( 'Maintenance.php' );
1615
@@ -76,20 +75,20 @@
7776
7877 $this->output( "Done.\n" );
7978 }
80 -}
8179
82 -function wfSetupUpdateScript() {
83 - global $wgLocalisationCacheConf;
 80+ protected function afterFinalSetup() {
 81+ global $wgLocalisationCacheConf;
8482
85 - # Don't try to access the database
86 - # This needs to be disabled early since extensions will try to use the l10n
87 - # cache from $wgExtensionSetupFunctions (bug 20471)
88 - $wgLocalisationCacheConf = array(
89 - 'class' => 'LocalisationCache',
90 - 'storeClass' => 'LCStore_Null',
91 - 'storeDirectory' => false,
92 - 'manualRecache' => false,
93 - );
 83+ # Don't try to access the database
 84+ # This needs to be disabled early since extensions will try to use the l10n
 85+ # cache from $wgExtensionSetupFunctions (bug 20471)
 86+ $wgLocalisationCacheConf = array(
 87+ 'class' => 'LocalisationCache',
 88+ 'storeClass' => 'LCStore_Null',
 89+ 'storeDirectory' => false,
 90+ 'manualRecache' => false,
 91+ );
 92+ }
9493 }
9594
9695 $maintClass = 'UpdateMediaWiki';
Index: trunk/phase3/maintenance/Maintenance.php
@@ -694,12 +694,10 @@
695695 $wgLBFactoryConf['serverTemplate']['user'] = $wgDBuser;
696696 $wgLBFactoryConf['serverTemplate']['password'] = $wgDBpassword;
697697 }
 698+ LBFactory::destroyInstance();
698699 }
699700
700 - if ( defined( 'MW_CMDLINE_CALLBACK' ) ) {
701 - $fn = MW_CMDLINE_CALLBACK;
702 - $fn();
703 - }
 701+ $this->afterFinalSetup();
704702
705703 $wgShowSQLErrors = true;
706704 @set_time_limit( 0 );
@@ -709,6 +707,15 @@
710708 }
711709
712710 /**
 711+ * Execute a callback function at the end of initialisation
 712+ */
 713+ protected function afterFinalSetup() {
 714+ if ( defined( 'MW_CMDLINE_CALLBACK' ) ) {
 715+ call_user_func( MW_CMDLINE_CALLBACK );
 716+ }
 717+ }
 718+
 719+ /**
713720 * Potentially debug globals. Originally a feature only
714721 * for refreshLinks
715722 */

Status & tagging log