r92848 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92847‎ | r92848 | r92849 >
Date:02:59, 22 July 2011
Author:aaron
Status:ok
Tags:
Comment:
* Follow-up r92794: updated require_once
* Added newlines to die() calls
* Added isset() check for $argv[1] to setSiteInfoForMaintenance()
Modified paths:
  • /trunk/tools/mwmultiversion/multiversion/MWMultiVersion.php (modified) (history)
  • /trunk/tools/mwmultiversion/multiversion/MWScript.php (modified) (history)

Diff [purge]

Index: trunk/tools/mwmultiversion/multiversion/MWMultiVersion.php
@@ -27,7 +27,7 @@
2828 */
2929 private static function createInstance() {
3030 if ( isset( self::$instance ) ) {
31 - die( "MWMultiVersion instance already set!" );
 31+ die( "MWMultiVersion instance already set!\n" );
3232 }
3333 self::$instance = new self;
3434 return self::$instance;
@@ -88,7 +88,7 @@
8989 $matches = array();
9090 if ( $secure ) {
9191 if ( !preg_match('/^([^.]+)\.([^.]+)\./', $secure, $matches ) ) {
92 - die( "invalid hostname" );
 92+ die( "Invalid hostname.\n" );
9393 }
9494 $lang = $matches[1];
9595 $site = $matches[2];
@@ -110,13 +110,13 @@
111111 } else if ( preg_match( '/^(.*)\.prototype\.wikimedia\.org$/', $serverName, $matches ) ) {
112112 $lang = $matches[1];
113113 } else {
114 - die( "Invalid host name ($serverName), can't determine language" );
 114+ die( "Invalid host name ($serverName), can't determine language.\n" );
115115 }
116116 } elseif ( preg_match( "/^\/usr\/local\/apache\/(?:htdocs|common\/docroot)\/([a-z0-9\-_]*)$/", $docRoot, $matches ) ) {
117117 $site = "wikipedia";
118118 $lang = $matches[1];
119119 } else {
120 - die( "Invalid host name (docroot=" . $docRoot . "), can't determine language." );
 120+ die( "Invalid host name (docroot=" . $docRoot . "), can't determine language.\n" );
121121 }
122122 }
123123 $this->loadDBFromSite( $site, $lang );
@@ -130,7 +130,7 @@
131131 private function setSiteInfoForUploadWiki( $pathInfo ) {
132132 $pathBits = explode( '/', $pathInfo );
133133 if ( count( $pathBits ) < 3 ) {
134 - die( "Invalid file path info (pathinfo=" . $pathInfo . "), can't determine language." );
 134+ die( "Invalid file path info (pathinfo=" . $pathInfo . "), can't determine language.\n" );
135135 }
136136 $site = $pathBits[1];
137137 $lang = $pathBits[2];
@@ -148,7 +148,7 @@
149149 $dbname = '';
150150 # The --wiki param must the second argument to to avoid
151151 # any "options with args" ambiguity (see Maintenance.php).
152 - if ( substr( $argv[1], 0, 7 ) === '--wiki=' ) {
 152+ if ( isset( $argv[1] ) && substr( $argv[1], 0, 7 ) === '--wiki=' ) {
153153 $dbname = substr( $argv[1], 7 );
154154 } elseif ( $argv[0] === 'addwiki.php' ) {
155155 # Most scripts assume that the wiki already exists. addwiki.php is
@@ -158,7 +158,7 @@
159159 }
160160
161161 if ( $dbname === '' ) {
162 - die( "--wiki must be the first parameter." );
 162+ die( "--wiki must be the first parameter.\n" );
163163 }
164164
165165 $this->db = $dbname;
@@ -200,7 +200,7 @@
201201 if ( $db ) {
202202 $version = dba_fetch( $this->getDatabase(), $db );
203203 if ( strpos( $version, 'php-' ) !== 0 ) {
204 - die( 'wikiversions.cdb entry should be of the format: php-...' );
 204+ die( "wikiversions.cdb entry should be of the format: php-...\n" );
205205 }
206206 } else {
207207 //trigger_error( "Unable to open /usr/local/apache/common/wikiversions.cdb. Assuming php-1.17", E_USER_ERROR );
Index: trunk/tools/mwmultiversion/multiversion/MWScript.php
@@ -39,7 +39,7 @@
4040 }
4141
4242 # MWScript.php should be in common/
43 - require_once( dirname( __FILE__ ) . '/../wmf-config/MWVersion.php' );
 43+ require_once( dirname( __FILE__ ) . '/MWVersion.php' );
4444 $file = getMediaWikiCli( $relFile );
4545 if ( !file_exists( $file ) ) {
4646 die( "The MediaWiki script file \"{$file}\" does not exist.\n" );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92794Restructure dir structure to make checkout and such easier. The live-1.5 MWVe...aaron21:28, 21 July 2011

Status & tagging log