]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - serialized/serialize-localisation.php
MediaWiki 1.14.0-scripts
[autoinstallsdev/mediawiki.git] / serialized / serialize-localisation.php
1 <?php
2
3 $wgNoDBParam = true;
4 $optionsWithArgs = array( 'o' );
5 require_once( dirname(__FILE__).'/../maintenance/commandLine.inc' );
6 require_once( dirname(__FILE__).'/serialize.php' );
7
8 $stderr = fopen( 'php://stderr', 'w' );
9 if ( !isset( $args[0] ) ) {
10         fwrite( $stderr, "No input file specified\n" );
11         exit( 1 );
12 }
13 $file = $args[0];
14 $code = str_replace( 'Messages', '', basename( $file ) );
15 $code = str_replace( '.php', '', $code );
16 $code = strtolower( str_replace( '_', '-', $code ) );
17
18 $localisation = Language::getLocalisationArray( $code, true );
19 if ( wfIsWindows() ) {
20         $localisation = unixLineEndings( $localisation );
21 }
22
23 if ( isset( $options['o'] ) ) {
24         $out = fopen( $options['o'], 'wb' );
25         if ( !$out ) {
26                 fwrite( $stderr, "Unable to open file \"{$options['o']}\" for output\n" );
27                 exit( 1 );
28         }
29 } else {
30         $out = fopen( 'php://stdout', 'wb' );
31 }
32
33 fwrite( $out, serialize( $localisation ) );
34
35