r52725 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52724‎ | r52725 | r52726 >
Date:02:31, 3 July 2009
Author:demon
Status:deferred
Tags:
Comment:
* Add methods to get list of all scripts, add $wgMaintenanceScripts for extensions to add to
* Add list of all core maintenance scripts in new framework. All _should_ be working at this point.
* Bunch of minor fixes
Modified paths:
  • /branches/maintenance-work/includes/DefaultSettings.php (modified) (history)
  • /branches/maintenance-work/maintenance/Maintenance.php (modified) (history)
  • /branches/maintenance-work/maintenance/attachLatest.php (modified) (history)
  • /branches/maintenance-work/maintenance/checkImages.php (modified) (history)
  • /branches/maintenance-work/maintenance/cleanupSpam.php (modified) (history)
  • /branches/maintenance-work/maintenance/convertUserOptions.php (modified) (history)
  • /branches/maintenance-work/maintenance/purgeList.php (modified) (history)
  • /branches/maintenance-work/maintenance/rebuildmessages.php (modified) (history)
  • /branches/maintenance-work/maintenance/renameDbPrefix.php (modified) (history)
  • /branches/maintenance-work/maintenance/updateSpecialPages.php (modified) (history)

Diff [purge]

Index: branches/maintenance-work/maintenance/attachLatest.php
@@ -80,3 +80,5 @@
8181
8282 $maintClass = "AttachLatest";
8383 require_once( DO_MAINTENANCE );
 84+
 85+ascu9a0scia-0cka,;m x;mm xm; {}lcascas
\ No newline at end of file
Index: branches/maintenance-work/maintenance/updateSpecialPages.php
@@ -117,3 +117,5 @@
118118 }
119119 }
120120
 121+$maintClass = "UpdateSpecialPages";
 122+require_once( DO_MAINTENANCE );
Index: branches/maintenance-work/maintenance/convertUserOptions.php
@@ -50,4 +50,7 @@
5151
5252 return $id;
5353 }
54 -}
\ No newline at end of file
 54+}
 55+
 56+$maintClass = "ConvertUserOptions";
 57+require_once( DO_MAINTENANCE );
Index: branches/maintenance-work/maintenance/checkImages.php
@@ -61,3 +61,5 @@
6262 }
6363 }
6464
 65+$maintClass = "CheckImages";
 66+require_once( DO_MAINTENANCE );
Index: branches/maintenance-work/maintenance/Maintenance.php
@@ -45,11 +45,18 @@
4646 protected $mDescription = '';
4747
4848 // Have we already loaded our user input?
49 - private $inputLoaded = false;
 49+ private $mInputLoaded = false;
5050
5151 // Batch size. If a script supports this, they should set
5252 // a default with setBatchSize()
5353 protected $mBatchSize = null;
 54+
 55+ /**
 56+ * List of all the core maintenance scripts. This is added
 57+ * to scripts added by extensions in $wgMaintenanceScripts
 58+ * and returned by getMaintenanceScripts()
 59+ */
 60+ protected static $mCoreScripts = null;
5461
5562 /**
5663 * Default constructor. Children should call this if implementing
@@ -322,7 +329,7 @@
323330 public function clearParamsAndArgs() {
324331 $this->mOptions = array();
325332 $this->mArgs = array();
326 - $this->inputLoaded = false;
 333+ $this->mInputLoaded = false;
327334 }
328335
329336 /**
@@ -338,21 +345,21 @@
339346 # If we were given opts or args, set those and return early
340347 if( $self ) {
341348 $this->mSelf = $self;
342 - $this->inputLoaded = true;
 349+ $this->mInputLoaded = true;
343350 }
344351 if( $opts ) {
345352 $this->mOptions = $opts;
346 - $this->inputLoaded = true;
 353+ $this->mInputLoaded = true;
347354 }
348355 if( $args ) {
349356 $this->mArgs = $args;
350 - $this->inputLoaded = true;
 357+ $this->mInputLoaded = true;
351358 }
352359
353360 # If we've already loaded input (either by user values or from $argv)
354361 # skip on loading it again. The array_shift() will corrupt values if
355362 # it's run again and again
356 - if( $this->inputLoaded ) {
 363+ if( $this->mInputLoaded ) {
357364 $this->loadSpecialVars();
358365 return;
359366 }
@@ -414,7 +421,7 @@
415422 $this->mOptions = $options;
416423 $this->mArgs = $args;
417424 $this->loadSpecialVars();
418 - $this->inputLoaded = true;
 425+ $this->mInputLoaded = true;
419426 }
420427
421428 /**
@@ -667,7 +674,98 @@
668675
669676 # Done
670677 $dbw->commit();
 678+ }
 679+
 680+ /**
 681+ * Get the list of available maintenance scripts. Note
 682+ * that if you call this _before_ calling doMaintenance
 683+ * you won't have any extensions in it yet
 684+ * @return array
 685+ */
 686+ public static function getMaintenanceScripts() {
 687+ global $wgMaintenanceScripts;
 688+ return $wgMaintenanceScripts + self::getCoreScripts();
 689+ }
671690
 691+ /**
 692+ * Return all of the core maintenance scripts
 693+ * @return array
 694+ */
 695+ private static function getCoreScripts() {
 696+ if( !self::$mCoreScripts ) {
 697+ $d = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
 698+ self::$mCoreScripts = array(
 699+ 'AttachLatest' => $d . 'attachLatest.php',
 700+ 'BenchmarkPurge' => $d . 'benchmarkPurge.php',
 701+ 'ChangePassword' => $d . 'changePassword.php',
 702+ 'CheckAutoLoader' => $d . 'checkAutoLoader.php',
 703+ 'CheckBadRedirects' => $d . 'checkBadRedirects.php',
 704+ 'CheckImages' => $d . 'checkImages.php',
 705+ 'CheckSyntax' => $d . 'checkSyntax.php',
 706+ 'CheckUsernames' => $d . 'checkUsernames.php',
 707+ 'CleanupSpam' => $d . 'cleanupSpam.php',
 708+ 'ClearInterwikiCache' => $d . 'clear_interwiki_cache.php',
 709+ 'clear_stats' => $d . 'clear_stats.php',
 710+ 'ConvertLinks' => $d . 'convertLinks.php',
 711+ 'ConvertUserOptions' => $d . 'convertUserOptions.php',
 712+ 'CreateAndPromote' => $d . 'createAndPromote.php',
 713+ 'DeleteArchivedFiles' => $d . 'deleteArchivedFiles.php',
 714+ 'DeleteArchivedRevisions' => $d . 'deleteArchivedRevisions.php',
 715+ 'DeleteBatch' => $d . 'deleteBatch.php',
 716+ 'DeleteDefaultMessages' => $d . 'deleteDefaultMessages.php',
 717+ 'DeleteImageCache' => $d . 'deleteImageMemcached.php',
 718+ 'DeleteOldRevisions' => $d . 'deleteOldRevisions.php',
 719+ 'DeleteOrphanedRevisions' => $d . 'deleteOrphanedRevisions.php',
 720+ 'DeleteRevision' => $d . 'deleteRevision.php',
 721+ 'DumpLinks' => $d . 'dumpLinks.php',
 722+ 'DumpSisterSites' => $d . 'dumpSisterSites.php',
 723+ 'UploadDumper' => $d . 'dumpUploads.php',
 724+ 'EditCLI' => $d . 'edit.php',
 725+ 'EvalPrompt' => $d . 'eval.php',
 726+ 'FetchText' => $d . 'fetchText.php',
 727+ 'FixUserRegistration' => $d . 'fixUserRegistration.php',
 728+ 'GenerateSitemap' => $d . 'generateSitemap.php',
 729+ 'GetLagTimes' => $d . 'getLagTimes.php',
 730+ 'GetSlaveServer' => $d . 'getSlaveServer.php',
 731+ 'InitEditCount' => $d . 'initEditCount.php',
 732+ 'InitStats' => $d . 'initStats.php',
 733+ 'mcTest' => $d . 'mctest.php',
 734+ 'MoveBatch' => $d . 'moveBatch.php',
 735+ 'nextJobDb' => $d . 'nextJobDB.php',
 736+ 'NukeNS' => $d . 'nukeNS.php',
 737+ 'NukePage' => $d . 'nukePage.php',
 738+ 'Orphans' => $d . 'orphans.php',
 739+ 'PopulateCategory' => $d . 'populateCategory.php',
 740+ 'PopulateLogSearch' => $d . 'populateLogSearch.php',
 741+ 'PopulateParentId' => $d . 'populateParentId.php',
 742+ 'Protect' => $d . 'protect.php',
 743+ 'PurgeList' => $d . 'purgeList.php',
 744+ 'PurgeOldText' => $d . 'purgeOldText.php',
 745+ 'ReassignEdits' => $d . 'reassignEdits.php',
 746+ 'RebuildAll' => $d . 'rebuildall.php',
 747+ 'RebuildFileCache' => $d . 'rebuildFileCache.php',
 748+ 'RebuildLocalisationCache' => $d . 'rebuildLocalisationCache.php',
 749+ 'RebuildMessages' => $d . 'rebuildmessages.php',
 750+ 'RebuildRecentchanges' => $d . 'rebuildrecentchanges.php',
 751+ 'RebuildTextIndex' => $d . 'rebuildtextindex.php',
 752+ 'RefreshImageCount' => $d . 'refreshImageCount.php',
 753+ 'RefreshLinks' => $d . 'refreshLinks.php',
 754+ 'RemoveUnusedAccounts' => $d . 'removeUnusedAccounts.php',
 755+ 'RenameDbPrefix' => $d . 'renameDbPrefix.php',
 756+ 'DumpRenderer' => $d . 'renderDump.php',
 757+ 'RunJobs' => $d . 'runJobs.php',
 758+ 'ShowJobs' => $d . 'showJobs.php',
 759+ 'ShowStats' => $d . 'showStats.php',
 760+ 'MwSql' => $d . 'sql.php',
 761+ 'CacheStats' => $d . 'stats.php',
 762+ 'Undelete' => $d . 'undelete.php',
 763+ 'UpdateArticleCount' => $d . 'updateArticleCount.php',
 764+ 'UpdateRestrictions' => $d . 'updateRestrictions.php',
 765+ 'UpdateSearchIndex' => $d . 'updateSearchIndex.php',
 766+ 'UpdateSpecialPages' => $d . 'updateSpecialPages.php',
 767+ 'WaitForSlave' => $d . 'waitForSlave.php',
 768+ );
 769+ }
 770+ return self::$mCoreScripts;
672771 }
673772 }
674 -
Index: branches/maintenance-work/maintenance/renameDbPrefix.php
@@ -62,3 +62,6 @@
6363 $this->output( "Done! [$count tables]\n" );
6464 }
6565 }
 66+
 67+$maintClass = "RenameDbPrefix";
 68+require_once( DO_MAINTENANCE );
Index: branches/maintenance-work/maintenance/cleanupSpam.php
@@ -111,3 +111,6 @@
112112 }
113113 }
114114 }
 115+
 116+$maintClass = "CleanupSpam";
 117+require_once( DO_MAINTENANCE );
Index: branches/maintenance-work/maintenance/purgeList.php
@@ -45,3 +45,5 @@
4646 }
4747 }
4848
 49+$maintClass = "PurgeList";
 50+require_once( DO_MAINTENANCE );
Index: branches/maintenance-work/maintenance/rebuildmessages.php
@@ -31,4 +31,5 @@
3232 }
3333 }
3434
35 -
 35+$maintClass = "RebuildMessages";
 36+require_once( DO_MAINTENANCE );
Index: branches/maintenance-work/includes/DefaultSettings.php
@@ -3867,3 +3867,10 @@
38683868 * modify the user rights of those users via Special:UserRights
38693869 */
38703870 $wgUserrightsInterwikiDelimiter = '@';
 3871+
 3872+/**
 3873+ * Array for extensions to register their maintenance scripts with the
 3874+ * system. The key is the name of the class and the value is the full
 3875+ * path to the file
 3876+ */
 3877+$wgMaintenanceScripts = array();

Status & tagging log