r92504 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92503‎ | r92504 | r92505 >
Date:23:08, 18 July 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Follow-up r92499: removed useless member vars
Modified paths:
  • /trunk/tools/mwmultiversion/MWScript.php (modified) (history)
  • /trunk/tools/mwmultiversion/wmf-config/MWMultiVersion.php (modified) (history)

Diff [purge]

Index: trunk/tools/mwmultiversion/wmf-config/MWMultiVersion.php
@@ -8,10 +8,10 @@
99 * @var MWMultiVersion
1010 */
1111 private static $instance;
12 -
 12+ /**
 13+ * @var string
 14+ */
1315 private $db;
14 - private $site;
15 - private $lang;
1616
1717 /**
1818 * To get an inststance of this class, use the statuc helper methods.
@@ -94,36 +94,36 @@
9595 if ( !preg_match('/^([^.]+)\.([^.]+)\./', $secure, $matches ) ) {
9696 die( "invalid hostname" );
9797 }
98 - $this->lang = $matches[1];
99 - $this->site = $matches[2];
 98+ $lang = $matches[1];
 99+ $site = $matches[2];
100100
101101 // @TODO: move/use some special case dblist?
102102 $idioSyncratics = array( "commons", "grants", "sources", "wikimania",
103103 "wikimania2006", "foundation", "meta" );
104 - if ( in_array( $this->lang, $idioSyncratics ) ) {
105 - $this->site = "wikipedia";
 104+ if ( in_array( $lang, $idioSyncratics ) ) {
 105+ $site = "wikipedia";
106106 }
107107 } else {
108 - $this->site = "wikipedia";
 108+ $site = "wikipedia";
109109 if ( preg_match( '/^(?:\/usr\/local\/apache\/|\/home\/wikipedia\/)(?:htdocs|common\/docroot)\/([a-z]+)\.org/', $docRoot, $matches ) ) {
110 - $this->site = $matches[1];
111 - if ( preg_match( '/^(.*)\.' . preg_quote( $this->site ) . '\.org$/', $serverName, $matches ) ) {
112 - $this->lang = $matches[1];
 110+ $site = $matches[1];
 111+ if ( preg_match( '/^(.*)\.' . preg_quote( $site ) . '\.org$/', $serverName, $matches ) ) {
 112+ $lang = $matches[1];
113113 // For some special subdomains, like pa.us
114 - $this->lang = str_replace( '.', '-', $this->lang );
 114+ $lang = str_replace( '.', '-', $lang );
115115 } else if ( preg_match( '/^(.*)\.prototype\.wikimedia\.org$/', $serverName, $matches ) ) {
116 - $this->lang = $matches[1];
 116+ $lang = $matches[1];
117117 } else {
118118 die( "Invalid host name ($serverName), can't determine language" );
119119 }
120120 } elseif ( preg_match( "/^\/usr\/local\/apache\/(?:htdocs|common\/docroot)\/([a-z0-9\-_]*)$/", $docRoot, $matches ) ) {
121 - $this->site = "wikipedia";
122 - $this->lang = $matches[1];
 121+ $site = "wikipedia";
 122+ $lang = $matches[1];
123123 } else {
124124 die( "Invalid host name (docroot=" . $docRoot . "), can't determine language." );
125125 }
126126 }
127 - $this->loadDBFromSite( $this->site, $this->lang );
 127+ $this->loadDBFromSite( $site, $lang );
128128 }
129129
130130 /**
@@ -136,9 +136,9 @@
137137 if ( count( $pathBits ) < 3 ) {
138138 die( "Invalid file path info (pathinfo=" . $pathInfo . "), can't determine language." );
139139 }
140 - $this->site = $pathBits[1];
141 - $this->lang = $pathBits[2];
142 - $this->loadDBFromSite( $this->site, $this->lang );
 140+ $site = $pathBits[1];
 141+ $lang = $pathBits[2];
 142+ $this->loadDBFromSite( $site, $lang );
143143 }
144144
145145 /**
Index: trunk/tools/mwmultiversion/MWScript.php
@@ -42,7 +42,7 @@
4343 die( "The MediaWiki script file \"{$file}\" does not exist." );
4444 }
4545
46 - # Run the script!
 46+ # Run the script! (for HipHip, we will need to shell out here)
4747 require_once( $file );
4848 }
4949

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92499* Removed getSite()/getLang() from MWMultiVersion.php; unnecessary and adds a...aaron23:02, 18 July 2011

Comments

#Comment by 😂 (talk | contribs)   20:11, 22 July 2011

HipHip hooray!

Status & tagging log