Index: trunk/tools/mwmultiversion/multiversion/activeMWVersions |
— | — | @@ -1,5 +1,6 @@ |
2 | 2 | #!/usr/bin/env php |
3 | 3 | <?php |
| 4 | +error_reporting( 0 ); |
4 | 5 | /* |
5 | 6 | * Returns a space separated list of all active MW versions (e.g. "x.xx"). |
6 | 7 | * Versions are read from /usr/local/apache/common-local/wikiversions.cdb. |
— | — | @@ -7,6 +8,7 @@ |
8 | 9 | * Given --home, versions are instead read from /home/wikipedia/common/wikiversions.cdb. |
9 | 10 | * Given --withdb, each item in the list will be appended with '=' followed by |
10 | 11 | * the DB name of *some* wiki that uses that version. Used to run maintenance scripts. |
| 12 | + * Given --report, error messages would be displayed if this dies. |
11 | 13 | * |
12 | 14 | * @return string |
13 | 15 | */ |
— | — | @@ -23,13 +25,22 @@ |
24 | 26 | |
25 | 27 | $verList = array_filter( explode( "\n", file_get_contents( $path ) ) ); |
26 | 28 | if ( !count( $verList ) ) { |
27 | | - die( "Unable to read wikiversions.dat.\n" ); |
| 29 | + if ( in_array( '--report', $options ) ) { |
| 30 | + echo( "Unable to read wikiversions.dat.\n" ); |
| 31 | + } |
| 32 | + die( 1 ); |
28 | 33 | } |
29 | 34 | |
30 | 35 | $result = $activeVersions = array(); |
31 | 36 | foreach ( $verList as $item ) { |
32 | 37 | list( $dbname, $version ) = explode( ' ', $item ); |
33 | | - $version = str_replace( 'php-', '', $version ); // remove 'php-' |
| 38 | + if ( substr( $version, 0, 4 ) !== 'php-' ) { |
| 39 | + if ( in_array( '--report', $options ) ) { |
| 40 | + echo( "Unable to read wikiversions.dat entry: $version.\n" ); |
| 41 | + } |
| 42 | + die( 1 ); |
| 43 | + } |
| 44 | + $version = substr( $version, 4 ); // remove 'php-' |
34 | 45 | if ( !isset( $activeVersions[$version] ) ) { |
35 | 46 | $activeVersions[$version] = 1; |
36 | 47 | if ( in_array( '--withdb', $options ) ) { |