r70192 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70191‎ | r70192 | r70193 >
Date:08:31, 30 July 2010
Author:siebrand
Status:deferred
Tags:
Comment:
Remove obsolete and broken alias-export.php.

Per RobertL's analysis:
* alias-export.php uses a backend that is no longer in use and so is beyond repair as far as I can tell, it could probably be deprecated and deleted (unless there is a use I am missing);
* export-magic.php takes hideously long because it loops through every extension available, and then every language available for that group - causing ~400 message loads for ~400 extensions... ~160,000 message loads per export! I think it would make more sense to do it the other way round, resulting in only 400 message loads and a very efficient process.

magic-export-2.php will be the replacement of magic-export.php but is still in the works.
Modified paths:
  • /trunk/extensions/Translate/scripts/alias-export.php (deleted) (history)

Diff [purge]

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 -}

Status & tagging log