r98279 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98278‎ | r98279 | r98280 >
Date:22:48, 27 September 2011
Author:aaron
Status:ok
Tags:
Comment:
svn:eol-style native
Modified paths:
  • /trunk/tools/mwmultiversion/multiversion/getMWVersion (modified) (history)

Diff [purge]

Index: trunk/tools/mwmultiversion/multiversion/getMWVersion
@@ -1,26 +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] );
 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:eol-style
2828 + native

Status & tagging log