r92645 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92644‎ | r92645 | r92646 >
Date:17:50, 20 July 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Enforce "php-" version dir format
Modified paths:
  • /trunk/tools/mwmultiversion/checkoutMediaWiki.php (modified) (history)
  • /trunk/tools/mwmultiversion/wmf-config/MWMultiVersion.php (modified) (history)

Diff [purge]

Index: trunk/tools/mwmultiversion/wmf-config/MWMultiVersion.php
@@ -34,7 +34,7 @@
3535 }
3636
3737 /**
38 - * Factory method to get an instance of MWMultiVersion.
 38+ * Factory method to get an instance of MWMultiVersion.
3939 * Use this for all wikis except calls to /w/thumb.php on upload.wikmedia.org.
4040 * @param $serverName the ServerName for this wiki -- $_SERVER['SERVER_NAME']
4141 * @param $docRoot the DocumentRoot for this wiki -- $_SERVER['DOCUMENT_ROOT']
@@ -43,7 +43,7 @@
4444 public static function initializeForWiki( $serverName, $docRoot ) {
4545 $instance = self::createInstance();
4646 $instance->setSiteInfoForWiki( $serverName, $docRoot );
47 - return $instance;
 47+ return $instance;
4848 }
4949
5050 /**
@@ -104,7 +104,7 @@
105105 $site = "wikipedia";
106106 }
107107 } else {
108 - $site = "wikipedia";
 108+ $site = "wikipedia";
109109 if ( preg_match( '/^(?:\/usr\/local\/apache\/|\/home\/wikipedia\/)(?:htdocs|common\/docroot)\/([a-z]+)\.org/', $docRoot, $matches ) ) {
110110 $site = $matches[1];
111111 if ( preg_match( '/^(.*)\.' . preg_quote( $site ) . '\.org$/', $serverName, $matches ) ) {
@@ -203,7 +203,7 @@
204204 $db = dba_open( '/usr/local/apache/common/wikiversions.cdb', 'r', 'cdb' );
205205 if ( $db ) {
206206 $version = dba_fetch( $this->getDatabase(), $db );
207 - if ( strpos( $version, '-' ) === false ) {
 207+ if ( strpos( $version, 'php-' ) !== 0 ) {
208208 die( 'wikiversions.cdb entry should be of the format: php-...' );
209209 }
210210 } else {
Index: trunk/tools/mwmultiversion/checkoutMediaWiki.php
@@ -29,7 +29,7 @@
3030 if ( count( $argv ) >= 3 ) {
3131 $svnVersion = $argv[1]; // e.g. "X.XXwmfX"
3232 $dstVersion = $argv[2]; // e.g. "php-X.XX"
33 - if ( preg_match( '/^php-(\d+\.\d+)$/', $dstVersion, $m ) ) {
 33+ if ( preg_match( '/^php-(\d+\.\d+|trunk)$/', $dstVersion, $m ) ) {
3434 $dstVersionNum = $m[1];
3535 $argsValid = true;
3636 }
@@ -122,7 +122,7 @@
123123 print "File already exists: $path\n";
124124 }
125125
126 - print "MediaWiki $dstVersionNum, from $svnVersion, successfully checked out.\n";
 126+ print "MediaWiki $dstVersionNum, from $svnVersion, successfully checked out.\n";
127127 }
128128
129129 checkoutMediaWiki();

Comments

#Comment by Catrope (talk | contribs)   19:00, 20 July 2011
+		if ( preg_match( '/^php-(\d+\.\d+|trunk)$/', $dstVersion, $m ) ) {

Maybe this should be a bit more flexible, in case we want to deploy e.g. 1.18wmf1 and 1.18wmf2 in parallel?

Status & tagging log