00001 <?php 00002 00003 $wgNoDBParam = true; 00004 $optionsWithArgs = array( 'o' ); 00005 require_once( dirname(__FILE__).'/../maintenance/commandLine.inc' ); 00006 require_once( dirname(__FILE__).'/serialize.php' ); 00007 00008 $stderr = fopen( 'php://stderr', 'w' ); 00009 if ( !isset( $args[0] ) ) { 00010 fwrite( $stderr, "No input file specified\n" ); 00011 exit( 1 ); 00012 } 00013 $file = $args[0]; 00014 $code = str_replace( 'Messages', '', basename( $file ) ); 00015 $code = str_replace( '.php', '', $code ); 00016 $code = strtolower( str_replace( '_', '-', $code ) ); 00017 00018 $localisation = Language::getLocalisationArray( $code, true ); 00019 if ( wfIsWindows() ) { 00020 $localisation = unixLineEndings( $localisation ); 00021 } 00022 00023 if ( isset( $options['o'] ) ) { 00024 $out = fopen( $options['o'], 'wb' ); 00025 if ( !$out ) { 00026 fwrite( $stderr, "Unable to open file \"{$options['o']}\" for output\n" ); 00027 exit( 1 ); 00028 } 00029 } else { 00030 $out = fopen( 'php://stdout', 'wb' ); 00031 } 00032 00033 fwrite( $out, serialize( $localisation ) ); 00034 00035