r109825 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109824‎ | r109825 | r109826 >
Date:14:52, 23 January 2012
Author:reedy
Status:ok
Tags:
Comment:
Reverting out changes to MWScript.php from r109711, r109739

Leaving changes to MWVersion.php intact
Modified paths:
  • /trunk/tools/mwmultiversion/multiversion/MWScript.php (modified) (history)

Diff [purge]

Index: trunk/tools/mwmultiversion/multiversion/MWScript.php
@@ -23,6 +23,12 @@
2424 die( "The MediaWiki script file path must be the first argument.\n" );
2525 }
2626
 27+ $relFile = $argv[1]; // the script file to run
 28+ # If no MW directory is given then assume this is a /maintenance script
 29+ if ( strpos( $relFile, '/' ) === false ) {
 30+ $relFile = "maintenance/$relFile"; // convenience
 31+ }
 32+
2733 # Remove effects of this wrapper from $argv...
2834 array_shift( $argv ); // remove this file's name from args
2935 # Code stolen from wfBasename() in GlobalFunctions.php :)
@@ -30,54 +36,33 @@
3137 $argv[0] = $matches[1]; // make first arg the script file name
3238 }
3339
34 - $maintenance = "maintenance/";
35 - $wikimediaMaintenance = "extensions/WikimediaMaintenance/";
3640 # For addwiki.php, the wiki DB doesn't yet exist, and for some
3741 # other maintenance scripts we don't care what wiki DB is used...
3842 $wikiless = array(
39 - $maintenance . 'mctest.php',
40 - $maintenance . 'addwiki.php',
41 - $maintenance . 'nextJobDB.php',
42 - $maintenance . 'dumpInterwiki.php',
43 - $maintenance . 'rebuildInterwiki.php',
44 - $wikimediaMaintenance . 'addWiki.php', // 1.19
45 - $wikimediaMaintenance . 'dumpInterwiki.php', // 1.19
46 - $wikimediaMaintenance . 'getJobQueueLengths.php',
47 - $wikimediaMaintenance . 'rebuildInterwiki.php' // 1.19
 43+ 'maintenance/mctest.php',
 44+ 'maintenance/addwiki.php',
 45+ 'maintenance/nextJobDB.php',
 46+ 'maintenance/dumpInterwiki.php',
 47+ 'maintenance/rebuildInterwiki.php',
 48+ 'extensions/WikimediaMaintenance/addWiki.php', // 1.19
 49+ 'extensions/WikimediaMaintenance/dumpInterwiki.php', // 1.19
 50+ 'extensions/WikimediaMaintenance/getJobQueueLengths.php',
 51+ 'extensions/WikimediaMaintenance/rebuildInterwiki.php' // 1.19
4852 );
4953
50 - $relFile = $argv[0];
51 -
5254 # Check if a --wiki param was given...
5355 # Maintenance.php will treat $argv[1] as the wiki if it doesn't start '-'
5456 if ( !isset( $argv[1] ) || !preg_match( '/^([^-]|--wiki(=|$))/', $argv[1] ) ) {
55 - // All the possible locations of a wikiless script
56 - $possibles = array( $relFile, $maintenance . $relFile, $wikimediaMaintenance . $relFile );
57 - foreach( $possibles as $poss ) {
58 - if ( in_array( $poss, $wikiless ) ) {
59 - # Assume aawiki as Maintenance.php does.
60 - $argv = array_merge( array( $argv[0], "--wiki=aawiki" ), array_slice( $argv, 1 ) );
61 - break;
62 - }
 57+ if ( in_array( $relFile, $wikiless ) ) {
 58+ # Assumme aawiki as Maintenance.php does.
 59+ $argv = array_merge( array( $argv[0], "--wiki=aawiki" ), array_slice( $argv, 1 ) );
6360 }
6461 }
6562
6663 # MWScript.php should be in common/
6764 require_once( dirname( __FILE__ ) . '/MWVersion.php' );
68 -
69 - if ( strpos( $relFile, '/' ) === false ) {
70 - // If no MW directory is given then assume this is either
71 - // a /maintenance or an extensions/WikimediaMaintenance/
72 - // script
73 - $file = getMediaWikiCli( $maintenance . $relFile );
74 - if ( !file_exists( $file ) ) {
75 - $file = getMediaWikiCli( $wikimediaMaintenance . $relFile );
76 - }
77 - } else {
78 - $file = getMediaWikiCli( $relFile );
79 - }
80 -
81 - if ( !file_exists( $file ) ) {
 65+ $file = getMediaWikiCli( $relFile );
 66+ if ( !file_exists( $file ) ) {
8267 die( "The MediaWiki script file \"{$file}\" does not exist.\n" );
8368 }
8469

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109711* (bug 33284) Make mwscript.php also look in WikimediaMaintenancereedy01:00, 22 January 2012
r109739Followup r109711...reedy15:13, 22 January 2012

Status & tagging log