Fix concern raised by Brion in r74108 (but has really existed since the maintenance...
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 13 Jan 2011 22:58:55 +0000 (22:58 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 13 Jan 2011 22:58:55 +0000 (22:58 +0000)
Until now, we relied on setting MW_NO_SETUP which was a) hacky, b) irreversable, and c) likely to be forgotten if you didn't use one of the wrappers like runChild().

Instead, move the freaky magic to doMaintenance and have *it* check if it's in a specific call stack that indicates this is being run from the file scope and should be executed. Rename DO_MAINTENANCE to RUN_MAINTENANCE_IF_MAIN so it's nice and clear what magic happens behind the require_once().

124 files changed:
docs/maintenance.txt
includes/installer/DatabaseUpdater.php
maintenance/Maintenance.php
maintenance/addwiki.php
maintenance/attachLatest.php
maintenance/benchmarks/bench_HTTP_HTTPS.php
maintenance/benchmarks/bench_strtr_str_replace.php
maintenance/benchmarks/bench_wfIsWindows.php
maintenance/benchmarks/benchmarkPurge.php
maintenance/changePassword.php
maintenance/checkAutoLoader.php
maintenance/checkBadRedirects.php
maintenance/checkImages.php
maintenance/checkSyntax.php
maintenance/checkUsernames.php
maintenance/cleanupCaps.php
maintenance/cleanupImages.php
maintenance/cleanupRemovedModules.php
maintenance/cleanupSpam.php
maintenance/cleanupTitles.php
maintenance/cleanupWatchlist.php
maintenance/clear_interwiki_cache.php
maintenance/clear_stats.php
maintenance/commandLine.inc
maintenance/compareParsers.php
maintenance/convertLinks.php
maintenance/convertUserOptions.php
maintenance/createAndPromote.php
maintenance/deleteArchivedFiles.php
maintenance/deleteArchivedRevisions.php
maintenance/deleteBatch.php
maintenance/deleteDefaultMessages.php
maintenance/deleteImageMemcached.php
maintenance/deleteOldRevisions.php
maintenance/deleteOrphanedRevisions.php
maintenance/deleteRevision.php
maintenance/deleteSelfExternals.php
maintenance/doMaintenance.php
maintenance/dumpInterwiki.php
maintenance/dumpLinks.php
maintenance/dumpSisterSites.php
maintenance/dumpUploads.php
maintenance/edit.php
maintenance/fetchText.php
maintenance/findhooks.php
maintenance/fixSlaveDesync.php
maintenance/fixTimestamps.php
maintenance/fixUserRegistration.php
maintenance/generateSitemap.php
maintenance/getLagTimes.php
maintenance/getSlaveServer.php
maintenance/getText.php
maintenance/httpSessionDownload.php
maintenance/importUseModWikipedia.php
maintenance/initEditCount.php
maintenance/initStats.php
maintenance/install.php
maintenance/lag.php
maintenance/language/alltrans.php
maintenance/language/countMessages.php
maintenance/language/date-formats.php
maintenance/language/digit2html.php
maintenance/language/dumpMessages.php
maintenance/language/generateNormalizerData.php
maintenance/language/lang2po.php
maintenance/language/langmemusage.php
maintenance/mctest.php
maintenance/mergeMessageFileList.php
maintenance/migrateUserGroup.php
maintenance/minify.php
maintenance/moveBatch.php
maintenance/namespaceDupes.php
maintenance/nextJobDB.php
maintenance/nukeNS.php
maintenance/nukePage.php
maintenance/orphans.php
maintenance/patchSql.php
maintenance/populateCategory.php
maintenance/populateLogSearch.php
maintenance/populateLogUsertext.php
maintenance/populateParentId.php
maintenance/populateRevisionLength.php
maintenance/populateSha1.php
maintenance/protect.php
maintenance/purgeList.php
maintenance/purgeOldText.php
maintenance/reassignEdits.php
maintenance/rebuildFileCache.php
maintenance/rebuildImages.php
maintenance/rebuildInterwiki.php
maintenance/rebuildLocalisationCache.php
maintenance/rebuildall.php
maintenance/rebuildmessages.php
maintenance/rebuildrecentchanges.php
maintenance/rebuildtextindex.php
maintenance/refreshImageCount.php
maintenance/refreshLinks.php
maintenance/removeUnusedAccounts.php
maintenance/renameDbPrefix.php
maintenance/renamewiki.php
maintenance/renderDump.php
maintenance/rollbackEdits.php
maintenance/runBatchedQuery.php
maintenance/runJobs.php
maintenance/showJobs.php
maintenance/showStats.php
maintenance/sql.php
maintenance/sqlite.php
maintenance/stats.php
maintenance/storage/dumpRev.php
maintenance/storage/fixBug20757.php
maintenance/storage/orphanStats.php
maintenance/storage/storageTypeStats.php
maintenance/undelete.php
maintenance/update.php
maintenance/updateArticleCount.php
maintenance/updateCollation.php
maintenance/updateDoubleWidthSearch.php
maintenance/updateRestrictions.php
maintenance/updateSearchIndex.php
maintenance/updateSpecialPages.php
maintenance/upgrade1_5.php
maintenance/waitForSlave.php
tests/RunSeleniumTests.php

index 039c71c..988ff28 100644 (file)
@@ -47,7 +47,7 @@ class DemoMaint extends Maintenance {
 }
 
 $maintClass = "DemoMaint";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
 ==END==
 
index badcc64..5bdfec5 100644 (file)
@@ -167,10 +167,6 @@ abstract class DatabaseUpdater {
        public function doUpdates( $purge = true ) {
                global $wgVersion;
 
-               if ( !defined( 'MW_NO_SETUP' ) ) {
-                       define( 'MW_NO_SETUP', true );
-               }
-
                $this->runUpdates( $this->getCoreUpdateList(), false );
                $this->runUpdates( $this->getOldGlobalUpdates(), false );
                $this->runUpdates( $this->getExtensionUpdates(), true );
index d048b7b..df2c63c 100644 (file)
@@ -21,7 +21,9 @@
  */
 
 // Define this so scripts can easily find doMaintenance.php
-define( 'DO_MAINTENANCE', dirname( __FILE__ ) . '/doMaintenance.php' );
+define( 'RUN_MAINTENANCE_IF_MAIN', dirname( __FILE__ ) . '/doMaintenance.php' );
+define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless
+
 $maintClass = false;
 
 // Make sure we're on PHP5 or better
@@ -116,6 +118,23 @@ abstract class Maintenance {
                register_shutdown_function( array( $this, 'outputChanneled' ), false );
        }
 
+       /**
+        * Should we execute the maintenance script, or just allow it to be included
+        * as a standalone class? It checks that the call stack only includes this
+        * function and a require (meaning was called from the file scope)
+        *
+        * @return Boolean
+        */
+       public static function shouldExecute() {
+               $bt = debug_backtrace();
+               if( count( $bt ) !== 2 ) {
+                       return false;
+               }
+               return $bt[1]['function'] == 'require_once' &&
+                       $bt[0]['class'] == 'Maintenance' &&
+                       $bt[0]['function'] == 'shouldExecute';
+       }
+
        /**
         * Do the actual work. All child classes will need to implement this
         */
@@ -389,10 +408,6 @@ abstract class Maintenance {
         * @return Maintenance child
         */
        public function runChild( $maintClass, $classFile = null ) {
-               // If we haven't already specified, kill setup procedures
-               // for child scripts, we've already got a sane environment
-               self::disableSetup();
-
                // Make sure the class is loaded first
                if ( !class_exists( $maintClass ) ) {
                        if ( $classFile ) {
@@ -408,15 +423,6 @@ abstract class Maintenance {
                return $child;
        }
 
-       /**
-        * Disable Setup.php mostly
-        */
-       protected static function disableSetup() {
-               if ( !defined( 'MW_NO_SETUP' ) ) {
-                       define( 'MW_NO_SETUP', true );
-               }
-       }
-
        /**
         * Do some sanity checking and basic setup
         */
@@ -943,7 +949,6 @@ abstract class Maintenance {
         */
        protected static function getCoreScripts() {
                if ( !self::$mCoreScripts ) {
-                       self::disableSetup();
                        $paths = array(
                                dirname( __FILE__ ),
                                dirname( __FILE__ ) . '/gearman',
index 7a0fa6f..53699f2 100644 (file)
@@ -464,4 +464,4 @@ EOT;
 }
 
 $maintClass = "AddWiki";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 449b67f..e6287f4 100644 (file)
@@ -78,4 +78,4 @@ class AttachLatest extends Maintenance {
 }
 
 $maintClass = "AttachLatest";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 5c37492..0038b2d 100644 (file)
@@ -54,4 +54,4 @@ class bench_HTTP_HTTPS extends Benchmarker {
 }
 
 $maintClass = 'bench_HTTP_HTTPS';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 565f3a1..ae57698 100644 (file)
@@ -47,4 +47,4 @@ class bench_strtr_str_replace extends Benchmarker {
 }
 
 $maintClass = 'bench_strtr_str_replace';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 975f72a..4c35221 100644 (file)
@@ -58,4 +58,4 @@ class bench_wfIsWindows extends Benchmarker {
 }
 
 $maintClass = 'bench_wfIsWindows';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 7eaff8d..4ab7aa1 100644 (file)
@@ -103,4 +103,4 @@ class BenchmarkPurge extends Benchmarker {
 }
 
 $maintClass = "BenchmarkPurge";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index a306454..568952b 100644 (file)
@@ -50,4 +50,4 @@ class ChangePassword extends Maintenance {
 }
 
 $maintClass = "ChangePassword";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 9dc935e..d199b6f 100644 (file)
@@ -55,4 +55,4 @@ class CheckAutoLoader extends Maintenance {
 }
 
 $maintClass = "CheckAutoLoader";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index c5d89a0..52bfa65 100644 (file)
@@ -57,4 +57,4 @@ class CheckBadRedirects extends Maintenance {
 }
 
 $maintClass = "CheckBadRedirects";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index fa06461..96b93f2 100644 (file)
@@ -80,4 +80,4 @@ class CheckImages extends Maintenance {
 }
 
 $maintClass = "CheckImages";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index e73dcfa..396cac5 100644 (file)
@@ -295,5 +295,5 @@ class CheckSyntax extends Maintenance {
 }
 
 $maintClass = "CheckSyntax";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index 414d098..b368432 100644 (file)
@@ -52,4 +52,4 @@ class CheckUsernames extends Maintenance {
 }
 
 $maintClass = "CheckUsernames";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 495bfce..2d945a5 100644 (file)
@@ -95,4 +95,4 @@ class CapsCleanup extends TableCleanup {
 }
 
 $maintClass = "CapsCleanup";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 818b9ed..b25b9bb 100644 (file)
@@ -204,4 +204,4 @@ class ImageCleanup extends TableCleanup {
 }
 
 $maintClass = "ImageCleanup";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index a9ee968..fb8afd2 100644 (file)
@@ -86,4 +86,4 @@ class CleanupRemovedModules extends Maintenance {
 }
 
 $maintClass = "CleanupRemovedModules";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index ce3f726..8561281 100644 (file)
@@ -128,4 +128,4 @@ class CleanupSpam extends Maintenance {
 }
 
 $maintClass = "CleanupSpam";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index bb7aaa7..f03b795 100644 (file)
@@ -152,4 +152,4 @@ class TitleCleanup extends TableCleanup {
 }
 
 $maintClass = "TitleCleanup";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 8c85edf..a9b20fe 100644 (file)
@@ -85,4 +85,4 @@ class WatchlistCleanup extends TableCleanup {
 }
 
 $maintClass = "WatchlistCleanup";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index c1fd417..953bd4c 100644 (file)
@@ -51,4 +51,4 @@ class ClearInterwikiCache extends Maintenance {
 }
 
 $maintClass = "ClearInterwikiCache";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 4bd79a5..8f91864 100644 (file)
@@ -51,4 +51,4 @@ class clear_stats extends Maintenance {
 }
 
 $maintClass = "clear_stats";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 3228ab1..f57c0b6 100644 (file)
@@ -61,5 +61,5 @@ class CommandLineInc extends Maintenance {
 }
 
 $maintClass = 'CommandLineInc';
-require( DO_MAINTENANCE );
+require( RUN_MAINTENANCE_IF_MAIN );
 
index 87d00c6..069e55e 100644 (file)
@@ -191,4 +191,4 @@ class CompareParsers extends Maintenance {
 }
 
 $maintClass = "CompareParsers";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index d4c8cc2..85ef5c8 100644 (file)
@@ -251,4 +251,4 @@ This gives a huge speed improvement for very large links tables which are MyISAM
 }
 
 $maintClass = "ConvertLinks";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 2305443..278d40f 100644 (file)
@@ -70,4 +70,4 @@ class ConvertUserOptions extends Maintenance {
 }
 
 $maintClass = "ConvertUserOptions";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index d62e16a..8bff284 100644 (file)
@@ -72,4 +72,4 @@ class CreateAndPromote extends Maintenance {
 }
 
 $maintClass = "CreateAndPromote";
-require_once( DO_MAINTENANCE );
\ No newline at end of file
+require_once( RUN_MAINTENANCE_IF_MAIN );
\ No newline at end of file
index 61da0dc..6067c80 100644 (file)
@@ -49,4 +49,4 @@ class DeleteArchivedFiles extends Maintenance {
 }
 
 $maintClass = "DeleteArchivedFiles";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 0f77c53..0faa0ab 100644 (file)
@@ -52,4 +52,4 @@ class DeleteArchivedRevisions extends Maintenance {
 }
 
 $maintClass = "DeleteArchivedRevisions";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 9eb55a1..c8bb480 100644 (file)
@@ -110,4 +110,4 @@ class DeleteBatch extends Maintenance {
 }
 
 $maintClass = "DeleteBatch";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index ca10362..fc482ac 100644 (file)
@@ -79,4 +79,4 @@ class DeleteDefaultMessages extends Maintenance {
 }
 
 $maintClass = "DeleteDefaultMessages";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 2df582f..007f0d1 100644 (file)
@@ -72,4 +72,4 @@ class DeleteImageCache extends Maintenance {
 }
 
 $maintClass = "DeleteImageCache";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 736a242..ba76e9e 100644 (file)
@@ -97,5 +97,5 @@ class DeleteOldRevisions extends Maintenance {
 }
 
 $maintClass = "DeleteOldRevisions";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index 7b1235b..e972d1f 100644 (file)
@@ -85,5 +85,5 @@ class DeleteOrphanedRevisions extends Maintenance {
 }
 
 $maintClass = "DeleteOrphanedRevisions";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index 24fdbe4..5e8ecaa 100644 (file)
@@ -78,4 +78,4 @@ class DeleteRevision extends Maintenance {
 }
 
 $maintClass = "DeleteRevision";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 783a7dd..db23e92 100644 (file)
@@ -51,4 +51,4 @@ class DeleteSelfExternals extends Maintenance {
 }
 
 $maintClass = "DeleteSelfExternals";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 59f5042..e930cc6 100644 (file)
  * @ingroup Maintenance
  */
 
-if ( !defined( 'DO_MAINTENANCE' ) ) {
+if ( !defined( 'RUN_MAINTENANCE_IF_MAIN' ) ) {
        echo "This file must be included after Maintenance.php\n";
        exit( 1 );
 }
 
+// Wasn't included from the file scope, halt execution (probably wanted the class)
+if( !Maintenance::shouldExecute() ) {
+       return;
+}
+
 if ( !$maintClass || !class_exists( $maintClass ) ) {
        echo "\$maintClass is not set or is set to a non-existent class.\n";
        exit( 1 );
 }
 
-if ( defined( 'MW_NO_SETUP' ) ) {
-       return;
-}
-
 // Get an object to start us off
 $maintenance = new $maintClass();
 
index 3c690a9..e92a3ea 100644 (file)
@@ -250,5 +250,5 @@ class DumpInterwiki extends Maintenance {
 }
 
 $maintClass = "DumpInterwiki";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index a6049d8..39a9e95 100644 (file)
@@ -69,5 +69,5 @@ class DumpLinks extends Maintenance {
 }
 
 $maintClass = "DumpLinks";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index ce931ac..f5abcd1 100644 (file)
@@ -52,4 +52,4 @@ class DumpSisterSites extends Maintenance {
 }
 
 $maintClass = "DumpSisterSites";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 0db4be3..74c0cb0 100644 (file)
@@ -118,4 +118,4 @@ By default, outputs relative paths against the parent directory of \$wgUploadDir
 }
 
 $maintClass = "UploadDumper";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 30dfee1..0e82426 100644 (file)
@@ -85,5 +85,5 @@ class EditCLI extends Maintenance {
 }
 
 $maintClass = "EditCLI";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index ed2778b..ea56535 100644 (file)
@@ -81,4 +81,4 @@ class FetchText extends Maintenance {
 }
 
 $maintClass = "FetchText";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 8ea00d1..28add41 100644 (file)
@@ -211,4 +211,4 @@ class FindHooks extends Maintenance {
 }
 
 $maintClass = "FindHooks";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 4320be5..fe89294 100644 (file)
@@ -204,4 +204,4 @@ class FixSlaveDesync extends Maintenance {
 }
 
 $maintClass = "FixSlaveDesync";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 0c1adba..3e3bd0a 100644 (file)
@@ -118,4 +118,4 @@ class FixTimestamps extends Maintenance {
 }
 
 $maintClass = "FixTimestamps";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 8091c7a..d4ff7c2 100644 (file)
@@ -52,4 +52,4 @@ class FixUserRegistration extends Maintenance {
 }
 
 $maintClass = "FixUserRegistration";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index f68b3aa..a6527bd 100644 (file)
@@ -453,4 +453,4 @@ class GenerateSitemap extends Maintenance {
 }
 
 $maintClass = "GenerateSitemap";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index ab2c2aa..0322fa2 100644 (file)
@@ -51,4 +51,4 @@ class GetLagTimes extends Maintenance {
 }
 
 $maintClass = "GetLagTimes";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 755659a..a9d93f1 100644 (file)
@@ -47,4 +47,4 @@ class GetSlaveServer extends Maintenance {
 }
 
 $maintClass = "GetSlaveServer";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index b05c6f4..eb04411 100644 (file)
@@ -55,4 +55,4 @@ class GetTextMaint extends Maintenance {
 }
 
 $maintClass = "GetTextMaint";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 9b26fe1..3c4f16a 100644 (file)
@@ -54,4 +54,4 @@ class HttpSessionDownload extends Maintenance {
 }
 
 $maintClass = "HttpSessionDownload";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 618fbae..a14c4f4 100644 (file)
@@ -891,4 +891,4 @@ EOT
 }
 
 $maintClass = 'ImportUseModWikipedia';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 289315d..e421e29 100644 (file)
@@ -107,4 +107,4 @@ in the load balancer, usually indicating a replication environment.' );
 }
 
 $maintClass = "InitEditCount";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 9dd2721..1ec5c92 100644 (file)
@@ -80,4 +80,4 @@ class InitStats extends Maintenance {
 }
 
 $maintClass = "InitStats";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index fb509cf..09a7638 100644 (file)
@@ -90,4 +90,4 @@ class CommandLineInstaller extends Maintenance {
 
 $maintClass = "CommandLineInstaller";
 
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index df1cf70..dc8bff5 100644 (file)
@@ -63,4 +63,4 @@ class DatabaseLag extends Maintenance {
 }
 
 $maintClass = "DatabaseLag";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index d224e9f..f872e6a 100644 (file)
@@ -37,4 +37,4 @@ class AllTrans extends Maintenance {
 }
 
 $maintClass = "AllTrans";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index a8a7f7c..f949ddc 100644 (file)
@@ -62,4 +62,4 @@ class CountMessages extends Maintenance {
 }
 
 $maintClass = "CountMessages";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 32a923e..04f5e8b 100644 (file)
@@ -73,4 +73,4 @@ class DateFormats extends Maintenance {
 }
 
 $maintClass = "DateFormats";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index de99c36..a80ac01 100644 (file)
@@ -58,4 +58,4 @@ class Digit2Html extends Maintenance {
 }
 
 $maintClass = "Digit2Html";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index e676ce7..9bdda09 100644 (file)
@@ -43,4 +43,4 @@ class DumpMessages extends Maintenance {
 }
 
 $maintClass = "DumpMessages";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index be0b327..a958abf 100644 (file)
@@ -154,5 +154,5 @@ class GenerateNormalizerData extends Maintenance {
 }
 
 $maintClass = 'GenerateNormalizerData';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index 7d1421e..7e5dc47 100644 (file)
@@ -163,4 +163,4 @@ msgstr ""
 }
 
 $maintClass = "Lang2Po";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 40391cc..28fe120 100644 (file)
@@ -56,4 +56,4 @@ class LangMemUsage extends Maintenance {
 }
 
 $maintClass = "LangMemUsage";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index edc1d4a..651b295 100644 (file)
@@ -80,4 +80,4 @@ class mcTest extends Maintenance {
 }
 
 $maintClass = "mcTest";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index a914202..994f9bb 100644 (file)
@@ -55,7 +55,7 @@ class MergeMessageFileList extends Maintenance {
        }
 }
 
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
 foreach ( $mmfl['setupFiles'] as $fileName ) {
        if ( strval( $fileName ) === '' ) {
index 4dfdad1..c416320 100644 (file)
@@ -67,4 +67,4 @@ class MigrateUserGroup extends Maintenance {
 }
 
 $maintClass = "MigrateUserGroup";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 37818d6..e56e634 100644 (file)
@@ -128,4 +128,4 @@ class MinifyScript extends Maintenance {
 }
 
 $maintClass = 'MinifyScript';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 4bfe4a4..c749533 100644 (file)
@@ -107,4 +107,4 @@ class MoveBatch extends Maintenance {
 }
 
 $maintClass = "MoveBatch";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index a9fa8c1..dbb16bc 100644 (file)
@@ -307,4 +307,4 @@ class NamespaceConflictChecker extends Maintenance {
 }
 
 $maintClass = "NamespaceConflictChecker";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 7f6aa40..8d8229e 100644 (file)
@@ -100,4 +100,4 @@ class nextJobDB extends Maintenance {
 }
 
 $maintClass = "nextJobDb";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 9de3a37..c89fa94 100644 (file)
@@ -111,4 +111,4 @@ class NukeNS extends Maintenance {
 }
 
 $maintClass = "NukeNS";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 1057ea9..4a073a5 100644 (file)
@@ -110,4 +110,4 @@ class NukePage extends Maintenance {
 }
 
 $maintClass = "NukePage";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 46b9b27..dbbddb9 100644 (file)
@@ -231,4 +231,4 @@ class Orphans extends Maintenance {
 }
 
 $maintClass = "Orphans";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 9c59d6a..1f96d62 100644 (file)
@@ -56,4 +56,4 @@ class PatchSql extends Maintenance {
 }
 
 $maintClass = "PatchSql";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 71ba645..ce0765c 100644 (file)
@@ -141,4 +141,4 @@ TEXT;
 }
 
 $maintClass = "PopulateCategory";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 32f5d19..ce2d95c 100644 (file)
@@ -149,4 +149,4 @@ class PopulateLogSearch extends Maintenance {
 }
 
 $maintClass = "PopulateLogSearch";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index d3b1dd5..bb3927c 100644 (file)
@@ -78,5 +78,5 @@ class PopulateLogUsertext extends Maintenance {
 }
 
 $maintClass = "PopulateLogUsertext";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index 45255b0..387f5a5 100644 (file)
@@ -115,4 +115,4 @@ class PopulateParentId extends Maintenance {
 }
 
 $maintClass = "PopulateParentId";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index faad442..0af51dc 100644 (file)
@@ -95,4 +95,4 @@ class PopulateRevisionLength extends Maintenance {
 }
 
 $maintClass = "PopulateRevisionLength";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 2676409..1714c0d 100644 (file)
@@ -96,4 +96,4 @@ class PopulateSha1 extends Maintenance {
 }
 
 $maintClass = "PopulateSha1";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 9143ad9..aab84d6 100644 (file)
@@ -68,4 +68,4 @@ class Protect extends Maintenance {
 }
 
 $maintClass = "Protect";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index f5f89a1..2ae4b22 100644 (file)
@@ -61,4 +61,4 @@ class PurgeList extends Maintenance {
 }
 
 $maintClass = "PurgeList";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 4e2a927..0cbc724 100644 (file)
@@ -36,4 +36,4 @@ class PurgeOldText extends Maintenance {
 }
 
 $maintClass = "PurgeOldText";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 100f4b9..039422b 100644 (file)
@@ -169,5 +169,5 @@ class ReassignEdits extends Maintenance {
 }
 
 $maintClass = "ReassignEdits";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index ff059d8..841bbcd 100644 (file)
@@ -122,4 +122,4 @@ class RebuildFileCache extends Maintenance {
 }
 
 $maintClass = "RebuildFileCache";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 8fbeb1c..1848b10 100644 (file)
@@ -209,4 +209,4 @@ class ImageBuilder extends Maintenance {
 }
 
 $maintClass = 'ImageBuilder';
-require( DO_MAINTENANCE );
+require( RUN_MAINTENANCE_IF_MAIN );
index 5180a20..5bb4f4b 100644 (file)
@@ -288,5 +288,5 @@ class RebuildInterwiki extends Maintenance {
 }
 
 $maintClass = "RebuildInterwiki";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index 9733457..0ca9961 100644 (file)
@@ -130,4 +130,4 @@ class RebuildLocalisationCache extends Maintenance {
 }
 
 $maintClass = "RebuildLocalisationCache";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 3d2aebc..dbbed86 100644 (file)
@@ -52,4 +52,4 @@ class RebuildAll extends Maintenance {
 }
 
 $maintClass = "RebuildAll";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 335d534..de37da7 100644 (file)
@@ -47,4 +47,4 @@ class RebuildMessages extends Maintenance {
 }
 
 $maintClass = "RebuildMessages";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 1f3e0a8..8964d1a 100644 (file)
@@ -294,4 +294,4 @@ class RebuildRecentchanges extends Maintenance {
 }
 
 $maintClass = "RebuildRecentchanges";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 6c400bd..deabff7 100644 (file)
@@ -137,4 +137,4 @@ class RebuildTextIndex extends Maintenance {
 }
 
 $maintClass = "RebuildTextIndex";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 2a1890d..f9bdeea 100644 (file)
@@ -50,5 +50,5 @@ class RefreshImageCount extends Maintenance {
 }
 
 $maintClass = "RefreshImageCount";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index 34fcbfb..7c22644 100644 (file)
@@ -279,4 +279,4 @@ class RefreshLinks extends Maintenance {
 }
 
 $maintClass = 'RefreshLinks';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 5be1b59..44c27b3 100644 (file)
@@ -107,4 +107,4 @@ class RemoveUnusedAccounts extends Maintenance {
 }
 
 $maintClass = "RemoveUnusedAccounts";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index adeb540..dd09362 100644 (file)
@@ -84,4 +84,4 @@ class RenameDbPrefix extends Maintenance {
 }
 
 $maintClass = "RenameDbPrefix";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 3cd5099..338c45f 100644 (file)
@@ -86,4 +86,4 @@ class RenameWiki extends Maintenance {
 }
 
 $maintClass = "RenameWiki";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 4eae473..78c5b6f 100644 (file)
@@ -115,4 +115,4 @@ class DumpRenderer extends Maintenance {
 }
 
 $maintClass = "DumpRenderer";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 2be0566..e1c126e 100644 (file)
@@ -94,4 +94,4 @@ class RollbackEdits extends Maintenance {
 }
 
 $maintClass = 'RollbackEdits';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 970b392..dd3680c 100644 (file)
@@ -57,4 +57,4 @@ class BatchedQueryRunner extends Maintenance {
 
 
 $maintClass = "BatchedQueryRunner";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index d4916c3..a100034 100644 (file)
@@ -122,4 +122,4 @@ class RunJobs extends Maintenance {
 }
 
 $maintClass = "RunJobs";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 1a2dc42..886d7d4 100644 (file)
@@ -52,4 +52,4 @@ class ShowJobs extends Maintenance {
 }
 
 $maintClass = "ShowJobs";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 8daf507..b5e8525 100644 (file)
@@ -64,5 +64,5 @@ class ShowStats extends Maintenance {
 }
 
 $maintClass = "ShowStats";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index e601f88..e1f2bb5 100644 (file)
@@ -90,4 +90,4 @@ class SqlPromptPrinter {
 }
 
 $maintClass = "MwSql";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index e46b8e7..4cd225d 100644 (file)
@@ -128,4 +128,4 @@ class SqliteMaintenance extends Maintenance {
 }
 
 $maintClass = "SqliteMaintenance";
-require_once( DO_MAINTENANCE );
\ No newline at end of file
+require_once( RUN_MAINTENANCE_IF_MAIN );
\ No newline at end of file
index 8854d19..2cbbcf9 100644 (file)
@@ -87,4 +87,4 @@ class CacheStats extends Maintenance {
 }
 
 $maintClass = "CacheStats";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index db460b2..b200d8a 100644 (file)
@@ -76,4 +76,4 @@ class DumpRev extends Maintenance {
 }
 
 $maintClass = "DumpRev";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 9582949..d04a24f 100644 (file)
@@ -340,5 +340,5 @@ class FixBug20757 extends Maintenance {
 }
 
 $maintClass = 'FixBug20757';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index 55677e8..f30f07e 100644 (file)
@@ -67,4 +67,4 @@ class OrphanStats extends Maintenance {
 }
 
 $maintClass = "OrphanStats";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index dfa8f51..817659f 100644 (file)
@@ -112,5 +112,5 @@ SQL;
 }
 
 $maintClass = 'StorageTypeStats';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
 
index 721ef07..f7ea2a2 100644 (file)
@@ -52,4 +52,4 @@ class Undelete extends Maintenance {
 }
 
 $maintClass = "Undelete";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 4cb2194..9c42b44 100644 (file)
@@ -131,4 +131,4 @@ class UpdateMediaWiki extends Maintenance {
 }
 
 $maintClass = 'UpdateMediaWiki';
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 636d9fc..b0dceb5 100644 (file)
@@ -98,4 +98,4 @@ class UpdateArticleCount extends Maintenance {
 }
 
 $maintClass = "UpdateArticleCount";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 0a173cd..67b6b10 100644 (file)
@@ -125,4 +125,4 @@ TEXT;
 }
 
 $maintClass = "UpdateCollation";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index b187880..61545f8 100644 (file)
@@ -67,4 +67,4 @@ class UpdateDoubleWidthSearch extends Maintenance {
 }
 
 $maintClass = "UpdateDoubleWidthSearch";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 23d8aa2..c815f4b 100644 (file)
@@ -108,4 +108,4 @@ class UpdateRestrictions extends Maintenance {
 }
 
 $maintClass = "UpdateRestrictions";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 6de3ced..c73b465 100644 (file)
@@ -119,4 +119,4 @@ class UpdateSearchIndex extends Maintenance {
 }
 
 $maintClass = "UpdateSearchIndex";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 5d6c3f5..335a2b2 100644 (file)
@@ -140,4 +140,4 @@ class UpdateSpecialPages extends Maintenance {
 }
 
 $maintClass = "UpdateSpecialPages";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 0b2836c..22fab70 100644 (file)
@@ -1325,4 +1325,4 @@ END
 }
 
 $maintClass = 'FiveUpgrade';
-require( DO_MAINTENANCE );
+require( RUN_MAINTENANCE_IF_MAIN );
index 40a4bd7..720ca28 100644 (file)
@@ -34,4 +34,4 @@ class WaitForSlave extends Maintenance {
 }
 
 $maintClass = "WaitForSlave";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index ffa14db..e9270a8 100644 (file)
@@ -230,4 +230,4 @@ class SeleniumTester extends Maintenance {
 
 $maintClass = "SeleniumTester";
 
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );