r50932 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50931‎ | r50932 | r50933 >
Date:10:06, 23 May 2009
Author:shinjiman
Status:deferred
Tags:
Comment:
added support to output as PHP syntax
Modified paths:
  • /trunk/phase3/maintenance/language/checkDupeMessages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/checkDupeMessages.php
@@ -18,6 +18,8 @@
1919 } else {
2020 if (!strcmp($options['mode'],'wiki')) {
2121 $runMode = 'wiki';
 22+ } else if (!strcmp($options['mode'],'php')) {
 23+ $runMode = 'php';
2224 } else if (!strcmp($options['mode'],'raw')) {
2325 $runMode = 'raw';
2426 } else {
@@ -34,6 +36,7 @@
3537 * mode: Output format, can be either:
3638 * text: Text output on the console (default)
3739 * wiki: Wiki format, with * at beginning of each line
 40+ * php: Output text as PHP syntax in a array $dupeMessages
3841 * raw: Raw output for duplicates
3942 END;
4043 }
@@ -67,12 +70,18 @@
6871 $wgMessages[$langCodeC] = $messages;
6972 $count = 0;
7073
 74+ if (!strcmp($runMode,'php')) {
 75+ print("<?php\n");
 76+ print('$dupeMessages = array('."\n");
 77+ }
7178 foreach ($wgMessages[$langCodeC] as $key => $value) {
7279 foreach ($wgMessages[$langCode] as $ckey => $cvalue) {
7380 if (!strcmp($key,$ckey)) {
7481 if ((!strcmp($key,$ckey)) && (!strcmp($value,$cvalue))) {
7582 if (!strcmp($runMode,'raw')) {
7683 print("$key\n");
 84+ } else if (!strcmp($runMode,'php')) {
 85+ print("'$key' => '',\n");
7786 } else if (!strcmp($runMode,'wiki')) {
7887 $uKey = ucfirst($key);
7988 print("* MediaWiki:$uKey/$langCode\n");
@@ -84,6 +93,9 @@
8594 }
8695 }
8796 }
 97+ if (!strcmp($runMode,'php')) {
 98+ print(");\n");
 99+ }
88100 if (!strcmp($runMode,'text')) {
89101 if ($count == 1) {
90102 echo "\nThere are $count duplicated message in $langCode, against to $langCodeC.\n";

Status & tagging log