PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/mediawiki-integration/source/php/mediawiki/serialized/serialize-localisation.php

https://code.google.com/
PHP | 35 lines | 29 code | 6 blank | 0 comment | 6 complexity | c6b0eb66ba351a88ca099ac7422ed5f9 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-3.0
  1. <?php
  2. $wgNoDBParam = true;
  3. $optionsWithArgs = array( 'o' );
  4. require_once( dirname(__FILE__).'/../maintenance/commandLine.inc' );
  5. require_once( dirname(__FILE__).'/serialize.php' );
  6. $stderr = fopen( 'php://stderr', 'w' );
  7. if ( !isset( $args[0] ) ) {
  8. fwrite( $stderr, "No input file specified\n" );
  9. exit( 1 );
  10. }
  11. $file = $args[0];
  12. $code = str_replace( 'Messages', '', basename( $file ) );
  13. $code = str_replace( '.php', '', $code );
  14. $code = strtolower( str_replace( '_', '-', $code ) );
  15. $localisation = Language::getLocalisationArray( $code, true );
  16. if ( wfIsWindows() ) {
  17. $localisation = unixLineEndings( $localisation );
  18. }
  19. if ( isset( $options['o'] ) ) {
  20. $out = fopen( $options['o'], 'wb' );
  21. if ( !$out ) {
  22. fwrite( $stderr, "Unable to open file \"{$options['o']}\" for output\n" );
  23. exit( 1 );
  24. }
  25. } else {
  26. $out = fopen( 'php://stdout', 'wb' );
  27. }
  28. fwrite( $out, serialize( $localisation ) );
  29. ?>