Index: trunk/tools/mwmultiversion/scripts/wikiversions.dat.sample |
— | — | @@ -1,3 +0,0 @@ |
2 | | -trunkwiki trunk |
3 | | -enwiki php-1.17 |
4 | | -testwiki php-1.18 |
Index: trunk/tools/mwmultiversion/scripts/mwversionsinuse |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +#!/bin/sh |
| 3 | +# Returns a space separated list of all active MW versions (e.g. x.xx). |
| 4 | +# This script belongs in /usr/bin/ and should be in PATH. |
| 5 | +declare -a mwVersionsionNums |
| 6 | +while read line |
| 7 | +do |
| 8 | + mwVersion=${line#* } |
| 9 | + mwVersionNum=${mwVersion#*-} |
| 10 | + if [ -n "$mwVersion" -a -n "$mwVersionNum" ]; then |
| 11 | + mwVersionInArray=0 |
| 12 | + for i in "${mwVersionsionNums[@]}" |
| 13 | + do |
| 14 | + if [ "$i" -eq "$mwVersionNum" ]; then |
| 15 | + mwVersionInArray=1 |
| 16 | + break |
| 17 | + fi |
| 18 | + done |
| 19 | + if [ mwVersionInArray -eq 0 ]; then |
| 20 | + mwVersionsionNums=("${mwVersionsionNums[@]}" mwVersionNum) |
| 21 | + fi |
| 22 | + else |
| 23 | + echo "" |
| 24 | + exit 1 |
| 25 | + fi |
| 26 | +done < /usr/local/apache/common-local/wmf-config/wikiversions.cdb |
| 27 | +echo "${mwVersionsionNums[@]}" |
Index: trunk/tools/mwmultiversion/scripts/wikiversions.cdb.sample |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +trunkwiki php-trunk |
| 3 | +enwiki php-1.17 |
| 4 | +testwiki php-1.18 |
Property changes on: trunk/tools/mwmultiversion/scripts/wikiversions.cdb.sample |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 5 | + native |
Index: trunk/tools/mwmultiversion/wmf-config/CommonSettings.php |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | |
97 | 97 | # Determine domain and language and the directories for this instance |
98 | 98 | list( $site, $lang ) = $wgConf->siteFromDB( $wgDBname ); |
99 | | -$wgVersionDirectory = $multiVersion->getVersion(); |
| 99 | +$wgVersionNumber = $multiVersion->getVersionNumber(); |
100 | 100 | |
101 | 101 | # Is this database listed in $cluster.dblist? |
102 | 102 | if ( array_search( $wgDBname, $wgLocalDatabases ) === false ){ |
— | — | @@ -110,7 +110,7 @@ |
111 | 111 | |
112 | 112 | # Try configuration cache |
113 | 113 | |
114 | | -$filename = "/tmp/mw-cache-$wgVersionDirectory/conf-$wgDBname"; |
| 114 | +$filename = "/tmp/mw-cache-$wgVersionNumber/conf-$wgDBname"; |
115 | 115 | $globals = false; |
116 | 116 | if ( @filemtime( $filename ) >= filemtime( "$wmfConfigDir/InitialiseSettings.php" ) ) { |
117 | 117 | $cacheRecord = @file_get_contents( $filename ); |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | |
145 | 145 | # Save cache |
146 | 146 | $oldUmask = umask( 0 ); |
147 | | - @mkdir( '/tmp/mw-cache-' . $wgVersionDirectory, 0777 ); |
| 147 | + @mkdir( '/tmp/mw-cache-' . $wgVersionNumber, 0777 ); |
148 | 148 | $file = fopen( $filename, 'w' ); |
149 | 149 | if ( $file ) { |
150 | 150 | fwrite( $file, serialize( $globals ) ); |
— | — | @@ -182,18 +182,18 @@ |
183 | 183 | #$wgStyleSheetPath = '/w/skins-1.17'; |
184 | 184 | if ( $wgDBname == 'testwiki' ) { |
185 | 185 | // Make testing skin/JS changes easier |
186 | | - $wgExtensionAssetsPath = "$urlprotocol//test.wikipedia.org/w/extensions-" . $wgVersionDirectory; |
187 | | - $wgStyleSheetPath = "$urlprotocol//test.wikipedia.org/w/skins-" . $wgVersionDirectory; |
| 186 | + $wgExtensionAssetsPath = "$urlprotocol//test.wikipedia.org/w/extensions-" . $wgVersionNumber; |
| 187 | + $wgStyleSheetPath = "$urlprotocol//test.wikipedia.org/w/skins-" . $wgVersionNumber; |
188 | 188 | |
189 | 189 | } else { |
190 | | - $wgExtensionAssetsPath = "$urlprotocol//bits.wikimedia.org/w/extensions-" . $wgVersionDirectory; |
191 | | - $wgStyleSheetPath = "$urlprotocol//bits.wikimedia.org/skins-" . $wgVersionDirectory; |
| 190 | + $wgExtensionAssetsPath = "$urlprotocol//bits.wikimedia.org/w/extensions-" . $wgVersionNumber; |
| 191 | + $wgStyleSheetPath = "$urlprotocol//bits.wikimedia.org/skins-" . $wgVersionNumber; |
192 | 192 | } |
193 | 193 | $wgStylePath = $wgStyleSheetPath; |
194 | 194 | $wgArticlePath = "/wiki/$1"; |
195 | 195 | |
196 | 196 | $wgScriptPath = '/w'; |
197 | | -$wgLocalStylePath = "$wgScriptPath/skins-$wgVersionDirectory"; |
| 197 | +$wgLocalStylePath = "$wgScriptPath/skins-$wgVersionNumber"; |
198 | 198 | $wgStockPath = '/images'; |
199 | 199 | $wgScript = $wgScriptPath.'/index.php'; |
200 | 200 | $wgRedirectScript = $wgScriptPath.'/redirect.php'; |
— | — | @@ -204,7 +204,7 @@ |
205 | 205 | |
206 | 206 | $oldLabsWikis = array( 'en_labswikimedia', 'de_labswikimedia', 'flaggedrevs_labswikimedia' ); |
207 | 207 | if ( !in_array( $wgDBname, $oldLabsWikis ) ) { |
208 | | - $wgCacheDirectory = '/tmp/mw-cache-' . $wgVersionDirectory; |
| 208 | + $wgCacheDirectory = '/tmp/mw-cache-' . $wgVersionNumber; |
209 | 209 | } else { |
210 | 210 | # @TODO: remove this hack (use multiversioning proper) |
211 | 211 | $wgCacheDirectory = '/tmp/mw-cache-labs'; |
— | — | @@ -261,7 +261,7 @@ |
262 | 262 | $wgRCMaxAge = 30*86400; |
263 | 263 | |
264 | 264 | $wgUseTeX = true; |
265 | | -$wgTexvc = "/usr/local/bin/texvc"; |
| 265 | +$wgTexvc = "/usr/local/apache/uncommon/$wgVersionNumber/bin"; |
266 | 266 | $wgTmpDirectory = '/tmp'; |
267 | 267 | $wgLegalTitleChars = "+ %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF"; |
268 | 268 | |
Index: trunk/tools/mwmultiversion/wmf-config/MWMultiVersion.php |
— | — | @@ -194,18 +194,32 @@ |
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
198 | | - * Get the version as specified in a cdb file located in /usr/local/apache/common/wikiversions.db |
199 | | - * The key should be the dbname and the version should be the version directory for this wiki |
200 | | - * @return String the version wirectory for this wiki |
| 198 | + * Get the version as specified in a cdb file located |
| 199 | + * at /usr/local/apache/common/wikiversions.cdb. |
| 200 | + * The key should be the dbname and the version should be the version directory. |
| 201 | + * @return String the version directory for this wiki |
201 | 202 | */ |
202 | 203 | public function getVersion() { |
203 | 204 | $db = dba_open( '/usr/local/apache/common/wikiversions.cdb', 'r', 'cdb' ); |
204 | 205 | if ( $db ) { |
205 | 206 | $version = dba_fetch( $this->getDatabase(), $db ); |
| 207 | + if ( strpos( $version, '-' ) === false ) { |
| 208 | + die( 'wikiversions.cdb entry should be of the format: php-...' ); |
| 209 | + } |
206 | 210 | } else { |
207 | | - //trigger_error( "Unable to open /usr/local/apache/common/wikiversions.db. Assuming php-1.17", E_USER_ERROR ); |
| 211 | + //trigger_error( "Unable to open /usr/local/apache/common/wikiversions.cdb. Assuming php-1.17", E_USER_ERROR ); |
208 | 212 | $version = 'php-1.17'; |
209 | 213 | } |
210 | 214 | return $version; |
211 | 215 | } |
| 216 | + |
| 217 | + /** |
| 218 | + * Get the version number as specified in a cdb file located |
| 219 | + * at /usr/local/apache/common/wikiversions.cdb. |
| 220 | + * @return String the version number for this wiki (e.g. "x.xx" or "trunk") |
| 221 | + */ |
| 222 | + public function getVersionNumber() { |
| 223 | + list( /*...*/, $ver ) = explode( $this->getVersion(), '-', 2 ); |
| 224 | + return $ver; |
| 225 | + } |
212 | 226 | } |