Index: trunk/tools/mwmultiversion/multiversion/getMWVersion |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +#!/usr/bin/env php
|
| 3 | +<?php
|
| 4 | +error_reporting( 0 );
|
| 5 | +// This script prints the MW version associated with a specified wikidb.
|
| 6 | +if ( count( $argv ) < 2 ) {
|
| 7 | + die( "Usage: getMWVersion <dbname> \n" );
|
| 8 | +}
|
| 9 | +/**
|
| 10 | + * Prints the MW version associated with a specified wikidb (as listed e.g. in all.dblist).
|
| 11 | + * @param $dbName string
|
| 12 | + * @return string MW code version (e.g. "php-x.xx" or "php-trunk")
|
| 13 | + */
|
| 14 | +function getWikiVersion( $dbName ) {
|
| 15 | + $db = dba_open( '/usr/local/apache/common-local/wikiversions.cdb', 'r', 'cdb' );
|
| 16 | + if ( $db ) {
|
| 17 | + $version = dba_fetch( "ver:$dbName", $db );
|
| 18 | + dba_close( $db );
|
| 19 | + if ( $version !== false ) {
|
| 20 | + return $version; // found version entry
|
| 21 | + }
|
| 22 | + die( "wikiversions.cdb has no extra version entry for `$dbName`.\n" );
|
| 23 | + }
|
| 24 | + die( "Unable to open wikiversions.cdb.\n" );
|
| 25 | +}
|
| 26 | +
|
| 27 | +echo getWikiVersion( $argv[1] );
|
Property changes on: trunk/tools/mwmultiversion/multiversion/getMWVersion |
___________________________________________________________________ |
Added: svn:executable |
1 | 28 | + * |