Index: trunk/phase3/maintenance/Maintenance.php |
— | — | @@ -268,9 +268,7 @@ |
269 | 269 | protected function spawnChild( $maintClass, $classFile = null ) { |
270 | 270 | // If we haven't already specified, kill setup procedures |
271 | 271 | // for child scripts, we've already got a sane environment |
272 | | - if( !defined( 'MW_NO_SETUP' ) ) { |
273 | | - define( 'MW_NO_SETUP', true ); |
274 | | - } |
| 272 | + self::disableSetup(); |
275 | 273 | |
276 | 274 | // Make sure the class is loaded first |
277 | 275 | if( !class_exists( $maintClass ) ) { |
— | — | @@ -288,6 +286,14 @@ |
289 | 287 | } |
290 | 288 | |
291 | 289 | /** |
| 290 | + * Disable Setup.php mostly |
| 291 | + */ |
| 292 | + protected static function disableSetup() { |
| 293 | + if( !defined( 'MW_NO_SETUP' ) ) |
| 294 | + define( 'MW_NO_SETUP', true ); |
| 295 | + } |
| 296 | + |
| 297 | + /** |
292 | 298 | * Do some sanity checking and basic setup |
293 | 299 | */ |
294 | 300 | public function setup() { |
— | — | @@ -718,94 +724,38 @@ |
719 | 725 | |
720 | 726 | /** |
721 | 727 | * Return all of the core maintenance scripts |
722 | | - * @todo Don't make this list, maybe just scan all the files in /maintenance? |
| 728 | + * @todo Finish porting all scripts so this doesn't blow up |
723 | 729 | * @return array |
724 | 730 | */ |
725 | 731 | private static function getCoreScripts() { |
| 732 | + return array(); |
| 733 | + /** |
726 | 734 | if( !self::$mCoreScripts ) { |
727 | | - $d = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; |
728 | | - self::$mCoreScripts = array( |
729 | | - # Main script list |
730 | | - 'AddWiki' => $d . 'addwiki.php', |
731 | | - 'AttachLatest' => $d . 'attachLatest.php', |
732 | | - 'BenchmarkPurge' => $d . 'benchmarkPurge.php', |
733 | | - 'ChangePassword' => $d . 'changePassword.php', |
734 | | - 'CheckAutoLoader' => $d . 'checkAutoLoader.php', |
735 | | - 'CheckBadRedirects' => $d . 'checkBadRedirects.php', |
736 | | - 'CheckImages' => $d . 'checkImages.php', |
737 | | - 'CheckSyntax' => $d . 'checkSyntax.php', |
738 | | - 'CheckUsernames' => $d . 'checkUsernames.php', |
739 | | - 'CleanupSpam' => $d . 'cleanupSpam.php', |
740 | | - 'ClearInterwikiCache' => $d . 'clear_interwiki_cache.php', |
741 | | - 'clear_stats' => $d . 'clear_stats.php', |
742 | | - 'ConvertLinks' => $d . 'convertLinks.php', |
743 | | - 'ConvertUserOptions' => $d . 'convertUserOptions.php', |
744 | | - 'CreateAndPromote' => $d . 'createAndPromote.php', |
745 | | - 'DeleteArchivedFiles' => $d . 'deleteArchivedFiles.php', |
746 | | - 'DeleteArchivedRevisions' => $d . 'deleteArchivedRevisions.php', |
747 | | - 'DeleteBatch' => $d . 'deleteBatch.php', |
748 | | - 'DeleteDefaultMessages' => $d . 'deleteDefaultMessages.php', |
749 | | - 'DeleteImageCache' => $d . 'deleteImageMemcached.php', |
750 | | - 'DeleteOldRevisions' => $d . 'deleteOldRevisions.php', |
751 | | - 'DeleteOrphanedRevisions' => $d . 'deleteOrphanedRevisions.php', |
752 | | - 'DeleteRevision' => $d . 'deleteRevision.php', |
753 | | - 'DumpLinks' => $d . 'dumpLinks.php', |
754 | | - 'DumpSisterSites' => $d . 'dumpSisterSites.php', |
755 | | - 'UploadDumper' => $d . 'dumpUploads.php', |
756 | | - 'EditCLI' => $d . 'edit.php', |
757 | | - 'EvalPrompt' => $d . 'eval.php', |
758 | | - 'FetchText' => $d . 'fetchText.php', |
759 | | - 'FindHooks' => $d . 'findhooks.php', |
760 | | - 'FixSlaveDesync' => $d . 'fixSlaveDesync.php', |
761 | | - 'FixTimestamps' => $d . 'fixTimestamps.php', |
762 | | - 'FixUserRegistration' => $d . 'fixUserRegistration.php', |
763 | | - 'GenerateSitemap' => $d . 'generateSitemap.php', |
764 | | - 'GetLagTimes' => $d . 'getLagTimes.php', |
765 | | - 'GetSlaveServer' => $d . 'getSlaveServer.php', |
766 | | - 'InitEditCount' => $d . 'initEditCount.php', |
767 | | - 'InitStats' => $d . 'initStats.php', |
768 | | - 'mcTest' => $d . 'mctest.php', |
769 | | - 'MoveBatch' => $d . 'moveBatch.php', |
770 | | - 'nextJobDb' => $d . 'nextJobDB.php', |
771 | | - 'NukeNS' => $d . 'nukeNS.php', |
772 | | - 'NukePage' => $d . 'nukePage.php', |
773 | | - 'Orphans' => $d . 'orphans.php', |
774 | | - 'PopulateCategory' => $d . 'populateCategory.php', |
775 | | - 'PopulateLogSearch' => $d . 'populateLogSearch.php', |
776 | | - 'PopulateParentId' => $d . 'populateParentId.php', |
777 | | - 'PopulateSha1' => $d . 'populateSha1.php', |
778 | | - 'Protect' => $d . 'protect.php', |
779 | | - 'PurgeList' => $d . 'purgeList.php', |
780 | | - 'PurgeOldText' => $d . 'purgeOldText.php', |
781 | | - 'ReassignEdits' => $d . 'reassignEdits.php', |
782 | | - 'RebuildAll' => $d . 'rebuildall.php', |
783 | | - 'RebuildFileCache' => $d . 'rebuildFileCache.php', |
784 | | - 'RebuildLocalisationCache' => $d . 'rebuildLocalisationCache.php', |
785 | | - 'RebuildMessages' => $d . 'rebuildmessages.php', |
786 | | - 'RebuildRecentchanges' => $d . 'rebuildrecentchanges.php', |
787 | | - 'RebuildTextIndex' => $d . 'rebuildtextindex.php', |
788 | | - 'RefreshImageCount' => $d . 'refreshImageCount.php', |
789 | | - 'RefreshLinks' => $d . 'refreshLinks.php', |
790 | | - 'RemoveUnusedAccounts' => $d . 'removeUnusedAccounts.php', |
791 | | - 'RenameDbPrefix' => $d . 'renameDbPrefix.php', |
792 | | - 'RenameWiki' => $d . 'renamewiki.php', |
793 | | - 'DumpRenderer' => $d . 'renderDump.php', |
794 | | - 'RunJobs' => $d . 'runJobs.php', |
795 | | - 'ShowJobs' => $d . 'showJobs.php', |
796 | | - 'ShowStats' => $d . 'showStats.php', |
797 | | - 'MwSql' => $d . 'sql.php', |
798 | | - 'CacheStats' => $d . 'stats.php', |
799 | | - 'Undelete' => $d . 'undelete.php', |
800 | | - 'UpdateArticleCount' => $d . 'updateArticleCount.php', |
801 | | - 'UpdateRestrictions' => $d . 'updateRestrictions.php', |
802 | | - 'UpdateSearchIndex' => $d . 'updateSearchIndex.php', |
803 | | - 'UpdateSpecialPages' => $d . 'updateSpecialPages.php', |
804 | | - 'WaitForSlave' => $d . 'waitForSlave.php', |
805 | | - |
806 | | - # Language scripts |
807 | | - 'AllTrans' => $d . 'language/alltrans.php', |
| 735 | + self::disableSetup(); |
| 736 | + $paths = array( |
| 737 | + dirname( __FILE__ ), |
| 738 | + dirname( __FILE__ ) . '/gearman', |
| 739 | + dirname( __FILE__ ) . '/language', |
| 740 | + dirname( __FILE__ ) . '/storage', |
808 | 741 | ); |
| 742 | + self::$mCoreScripts = array(); |
| 743 | + foreach( $paths as $p ) { |
| 744 | + $handle = opendir( $p ); |
| 745 | + while( ( $file = readdir( $handle ) ) !== false ) { |
| 746 | + $file = $p . '/' . $file; |
| 747 | + if( is_dir( $file ) || !strpos( $file, '.php' ) ) { |
| 748 | + continue; |
| 749 | + } |
| 750 | + require( $file ); |
| 751 | + $vars = get_defined_vars(); |
| 752 | + if( array_key_exists( 'maintClass', $vars ) ) { |
| 753 | + self::$mCoreScripts[$vars['maintClass']] = $file; |
| 754 | + } |
| 755 | + } |
| 756 | + closedir( $handle ); |
| 757 | + } |
809 | 758 | } |
810 | 759 | return self::$mCoreScripts; |
| 760 | + */ |
811 | 761 | } |
812 | 762 | } |