Index: trunk/extensions/Translate/scripts/alias-export.php |
— | — | @@ -1,75 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Script to export special page aliases of extensions. |
5 | | - * |
6 | | - * @author Niklas Laxstrom |
7 | | - * |
8 | | - * @copyright Copyright © 2008-2009, Niklas Laxström |
9 | | - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
10 | | - * @file |
11 | | - */ |
12 | | - |
13 | | -$optionsWithArgs = array( 'lang', 'target' ); |
14 | | -require( dirname( __FILE__ ) . '/cli.inc' ); |
15 | | - |
16 | | -function showUsage() { |
17 | | - STDERR( <<<EOT |
18 | | -Alias exporter. |
19 | | - |
20 | | -Usage: php alias-export.php [options...] |
21 | | - |
22 | | -Options: |
23 | | - --target Target directory for exported files |
24 | | - --lang Comma separated list of language codes or * |
25 | | -EOT |
26 | | -); |
27 | | - exit( 1 ); |
28 | | -} |
29 | | - |
30 | | -if ( isset( $options['help'] ) || $args === 1 ) { |
31 | | - showUsage(); |
32 | | -} |
33 | | - |
34 | | -if ( !isset( $options['target'] ) ) { |
35 | | - STDERR( "You need to specify target directory" ); |
36 | | - exit( 1 ); |
37 | | -} |
38 | | -if ( !isset( $options['lang'] ) ) { |
39 | | - STDERR( "You need to specify languages to export" ); |
40 | | - exit( 1 ); |
41 | | -} |
42 | | - |
43 | | -if ( !is_writable( $options['target'] ) ) { |
44 | | - STDERR( "Target directory is not writable" ); |
45 | | - exit( 1 ); |
46 | | -} |
47 | | - |
48 | | -$langs = Cli::parseLanguageCodes( $options['lang'] ); |
49 | | - |
50 | | -$groups = MessageGroups::singleton()->getGroups(); |
51 | | - |
52 | | -foreach ( $groups as $group ) { |
53 | | - if ( !$group instanceof ExtensionMessageGroup ) { |
54 | | - continue; |
55 | | - } |
56 | | - |
57 | | - $file = $group->getAliasFile(); |
58 | | - |
59 | | - $groupId = $group->getId(); |
60 | | - |
61 | | - if ( $file !== null ) { |
62 | | - // Fake a group |
63 | | - $group = new AliasMessageGroup( $group->getId() ); |
64 | | - $group->setMessageFile( $file ); |
65 | | - |
66 | | - // FIXME: getVariableNameAlias() is not read from mediawiki-defines.txt here apparently. |
67 | | - // Hacked this one exception in for now |
68 | | - if ( $groupId == 'ext-wikilog' ) { |
69 | | - $group->setVariableNameAlias( 'specialPageAliases' ); |
70 | | - } else { |
71 | | - $group->setVariableName( $group->getVariableNameAlias() ); |
72 | | - } |
73 | | - $writer = $group->getWriter(); |
74 | | - $writer->fileExport( $langs, $options['target'] ); |
75 | | - } |
76 | | -} |