From: Chad Horohoe Date: Tue, 4 Aug 2009 23:18:23 +0000 (+0000) Subject: Remove useless scripts list. Nothing depends on it yet really, so nobody will miss... X-Git-Tag: 1.31.0-rc.0~40502 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=6647e60bff12a1b50959a675d01886751f23b0f1;p=lhc%2Fweb%2Fwiklou.git Remove useless scripts list. Nothing depends on it yet really, so nobody will miss it. Instead iterate over all .php files in the maintenance directories and look for $maintClass. Keep this commented out for now, unported scripts cause this to blow up and I'm not writing stupid workarounds. --- diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 0e964d0eb7..4cc49d68bb 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -268,9 +268,7 @@ abstract class Maintenance { protected function spawnChild( $maintClass, $classFile = null ) { // If we haven't already specified, kill setup procedures // for child scripts, we've already got a sane environment - if( !defined( 'MW_NO_SETUP' ) ) { - define( 'MW_NO_SETUP', true ); - } + self::disableSetup(); // Make sure the class is loaded first if( !class_exists( $maintClass ) ) { @@ -287,6 +285,14 @@ 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 */ @@ -718,94 +724,38 @@ abstract class Maintenance { /** * Return all of the core maintenance scripts - * @todo Don't make this list, maybe just scan all the files in /maintenance? + * @todo Finish porting all scripts so this doesn't blow up * @return array */ private static function getCoreScripts() { + return array(); + /** if( !self::$mCoreScripts ) { - $d = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; - self::$mCoreScripts = array( - # Main script list - 'AddWiki' => $d . 'addwiki.php', - 'AttachLatest' => $d . 'attachLatest.php', - 'BenchmarkPurge' => $d . 'benchmarkPurge.php', - 'ChangePassword' => $d . 'changePassword.php', - 'CheckAutoLoader' => $d . 'checkAutoLoader.php', - 'CheckBadRedirects' => $d . 'checkBadRedirects.php', - 'CheckImages' => $d . 'checkImages.php', - 'CheckSyntax' => $d . 'checkSyntax.php', - 'CheckUsernames' => $d . 'checkUsernames.php', - 'CleanupSpam' => $d . 'cleanupSpam.php', - 'ClearInterwikiCache' => $d . 'clear_interwiki_cache.php', - 'clear_stats' => $d . 'clear_stats.php', - 'ConvertLinks' => $d . 'convertLinks.php', - 'ConvertUserOptions' => $d . 'convertUserOptions.php', - 'CreateAndPromote' => $d . 'createAndPromote.php', - 'DeleteArchivedFiles' => $d . 'deleteArchivedFiles.php', - 'DeleteArchivedRevisions' => $d . 'deleteArchivedRevisions.php', - 'DeleteBatch' => $d . 'deleteBatch.php', - 'DeleteDefaultMessages' => $d . 'deleteDefaultMessages.php', - 'DeleteImageCache' => $d . 'deleteImageMemcached.php', - 'DeleteOldRevisions' => $d . 'deleteOldRevisions.php', - 'DeleteOrphanedRevisions' => $d . 'deleteOrphanedRevisions.php', - 'DeleteRevision' => $d . 'deleteRevision.php', - 'DumpLinks' => $d . 'dumpLinks.php', - 'DumpSisterSites' => $d . 'dumpSisterSites.php', - 'UploadDumper' => $d . 'dumpUploads.php', - 'EditCLI' => $d . 'edit.php', - 'EvalPrompt' => $d . 'eval.php', - 'FetchText' => $d . 'fetchText.php', - 'FindHooks' => $d . 'findhooks.php', - 'FixSlaveDesync' => $d . 'fixSlaveDesync.php', - 'FixTimestamps' => $d . 'fixTimestamps.php', - 'FixUserRegistration' => $d . 'fixUserRegistration.php', - 'GenerateSitemap' => $d . 'generateSitemap.php', - 'GetLagTimes' => $d . 'getLagTimes.php', - 'GetSlaveServer' => $d . 'getSlaveServer.php', - 'InitEditCount' => $d . 'initEditCount.php', - 'InitStats' => $d . 'initStats.php', - 'mcTest' => $d . 'mctest.php', - 'MoveBatch' => $d . 'moveBatch.php', - 'nextJobDb' => $d . 'nextJobDB.php', - 'NukeNS' => $d . 'nukeNS.php', - 'NukePage' => $d . 'nukePage.php', - 'Orphans' => $d . 'orphans.php', - 'PopulateCategory' => $d . 'populateCategory.php', - 'PopulateLogSearch' => $d . 'populateLogSearch.php', - 'PopulateParentId' => $d . 'populateParentId.php', - 'PopulateSha1' => $d . 'populateSha1.php', - 'Protect' => $d . 'protect.php', - 'PurgeList' => $d . 'purgeList.php', - 'PurgeOldText' => $d . 'purgeOldText.php', - 'ReassignEdits' => $d . 'reassignEdits.php', - 'RebuildAll' => $d . 'rebuildall.php', - 'RebuildFileCache' => $d . 'rebuildFileCache.php', - 'RebuildLocalisationCache' => $d . 'rebuildLocalisationCache.php', - 'RebuildMessages' => $d . 'rebuildmessages.php', - 'RebuildRecentchanges' => $d . 'rebuildrecentchanges.php', - 'RebuildTextIndex' => $d . 'rebuildtextindex.php', - 'RefreshImageCount' => $d . 'refreshImageCount.php', - 'RefreshLinks' => $d . 'refreshLinks.php', - 'RemoveUnusedAccounts' => $d . 'removeUnusedAccounts.php', - 'RenameDbPrefix' => $d . 'renameDbPrefix.php', - 'RenameWiki' => $d . 'renamewiki.php', - 'DumpRenderer' => $d . 'renderDump.php', - 'RunJobs' => $d . 'runJobs.php', - 'ShowJobs' => $d . 'showJobs.php', - 'ShowStats' => $d . 'showStats.php', - 'MwSql' => $d . 'sql.php', - 'CacheStats' => $d . 'stats.php', - 'Undelete' => $d . 'undelete.php', - 'UpdateArticleCount' => $d . 'updateArticleCount.php', - 'UpdateRestrictions' => $d . 'updateRestrictions.php', - 'UpdateSearchIndex' => $d . 'updateSearchIndex.php', - 'UpdateSpecialPages' => $d . 'updateSpecialPages.php', - 'WaitForSlave' => $d . 'waitForSlave.php', - - # Language scripts - 'AllTrans' => $d . 'language/alltrans.php', + self::disableSetup(); + $paths = array( + dirname( __FILE__ ), + dirname( __FILE__ ) . '/gearman', + dirname( __FILE__ ) . '/language', + dirname( __FILE__ ) . '/storage', ); + self::$mCoreScripts = array(); + foreach( $paths as $p ) { + $handle = opendir( $p ); + while( ( $file = readdir( $handle ) ) !== false ) { + $file = $p . '/' . $file; + if( is_dir( $file ) || !strpos( $file, '.php' ) ) { + continue; + } + require( $file ); + $vars = get_defined_vars(); + if( array_key_exists( 'maintClass', $vars ) ) { + self::$mCoreScripts[$vars['maintClass']] = $file; + } + } + closedir( $handle ); + } } return self::$mCoreScripts; + */ } }