r55267 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55266‎ | r55267 | r55268 >
Date:20:39, 18 August 2009
Author:brion
Status:ok
Tags:
Comment:
Merge updater fixes from trunk. Note that the actual message cache hook-in doesn't work right now; as it seems to have been retooled for the new stuff in trunk and needs to be re-tooled back.
Modified paths:
  • /branches/wmf-deployment/extensions/LocalisationUpdate (modified) (history)
  • /branches/wmf-deployment/extensions/LocalisationUpdate/LocalisationUpdate.class.php (modified) (history)
  • /branches/wmf-deployment/extensions/LocalisationUpdate/update.php (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/LocalisationUpdate/update.php
@@ -12,23 +12,22 @@
1313 print "\n";
1414 print "Usage: php extensions/LocalisationUpdate/update.php\n";
1515 print "Options:\n";
16 - print " --quiet Suppress progress output\n";
17 - print " --all Fetch all present extensions, not just those enabled\n";
 16+ print " --quiet Suppress progress output\n";
 17+ print " --skip-core Don't fetch MediaWiki core files\n";
 18+ print " --skip-extensions Don't fetch any extension files\n";
 19+ print " --all Fetch all present extensions, not just those enabled\n";
1820 print "\n";
1921 exit( 0 );
2022 }
2123
2224
23 -$verbose = !isset( $options['quiet'] );
24 -$all = isset( $options['all'] );
25 -
2625 $starttime = microtime( true );
2726
2827 // Prevent the script from timing out
2928 set_time_limit( 0 );
3029 ini_set( "max_execution_time", 0 );
3130
32 -LocalisationUpdate::updateMessages( $verbose, $all );
 31+LocalisationUpdate::updateMessages( $options );
3332
3433 $endtime = microtime( true );
3534 $totaltime = ( $endtime - $starttime );
Index: branches/wmf-deployment/extensions/LocalisationUpdate/LocalisationUpdate.class.php
@@ -18,29 +18,42 @@
1919 }
2020
2121 // Called from the cronjob to fetch new messages from SVN
22 - public static function updateMessages( $verbose = false, $all = false ) {
 22+ public static function updateMessages( $options ) {
 23+ $verbose = !isset( $options['quiet'] );
 24+ $all = isset( $options['all'] );
 25+ $skipCore = isset( $options['skip-core'] );
 26+ $skipExtensions = isset( $options['skip-extensions'] );
 27+
2328 // Update all MW core messages
24 - $result = self::updateMediawikiMessages( $verbose );
 29+ if( !$skipCore ) {
 30+ $result = self::updateMediawikiMessages( $verbose );
 31+ }
2532
2633 // Update all Extension messages
27 - if( $all ) {
28 - global $IP;
29 - $extFiles = array();
30 - $messageFiles = glob( "$IP/extensions/*/*.i18n.php" );
31 - foreach( $messageFiles as $pathname ) {
32 - $filename = basename( $pathname );
33 - if( preg_match( '/^(.*)\.i18n\.php$/', $filename, $matches ) ) {
34 - $group = $matches[1];
35 - $extFiles[$group] = $pathname;
 34+ if( !$skipExtensions ) {
 35+ if( $all ) {
 36+ global $IP;
 37+ $extFiles = array();
 38+
 39+ // Look in extensions/ for all available items...
 40+ $dirs = new RecursiveDirectoryIterator( "$IP/extensions/" );
 41+
 42+ // I ain't kidding... RecursiveIteratorIterator.
 43+ foreach( new RecursiveIteratorIterator( $dirs ) as $pathname => $item ) {
 44+ $filename = basename( $pathname );
 45+ if( preg_match( '/^(.*)\.i18n\.php$/', $filename, $matches ) ) {
 46+ $group = $matches[1];
 47+ $extFiles[$group] = $pathname;
 48+ }
3649 }
 50+ } else {
 51+ global $wgExtensionMessagesFiles;
 52+ $extFiles = $wgExtensionMessagesFiles;
3753 }
38 - } else {
39 - global $wgExtensionMessagesFiles;
40 - $extFiles = $wgExtensionMessagesFiles;
 54+ foreach ( $extFiles as $extension => $locFile ) {
 55+ $result += self::updateExtensionMessages( $locFile, $extension, $verbose );
 56+ }
4157 }
42 - foreach ( $extFiles as $extension => $locFile ) {
43 - $result += self::updateExtensionMessages( $locFile, $extension, $verbose );
44 - }
4558
4659 // And output the result!
4760 self::myLog( "Updated {$result} messages in total" );
Property changes on: branches/wmf-deployment/extensions/LocalisationUpdate
___________________________________________________________________
Name: svn:mergeinfo
4861 - /branches/REL1_15/phase3/extensions/LocalisationUpdate:51646
/trunk/extensions/LocalisationUpdate:52089-55252
/trunk/phase3/LocalisationUpdate:52859,53272
/trunk/phase3/extensions/LocalisationUpdate:52290,52402,52404,52718,52737,52759,52776,52791,52800,52808,52812-52813,52815-52819,52822,52846,52850,52852-52853,52855-52857,52859,52924,52986,53128-53129,53190,53197,53199,53203-53204,53210-53211,53247,53249,53252,53267,53270,53293,53305,53344,53369,53427,53502-53504,53506,53777,54384,54494,54592,54599-54602,54604,54613,54764,54793,54806,55178
4962 + /branches/REL1_15/phase3/extensions/LocalisationUpdate:51646
/trunk/extensions/LocalisationUpdate:52089-55266
/trunk/phase3/LocalisationUpdate:52859,53272
/trunk/phase3/extensions/LocalisationUpdate:52290,52402,52404,52718,52737,52759,52776,52791,52800,52808,52812-52813,52815-52819,52822,52846,52850,52852-52853,52855-52857,52859,52924,52986,53128-53129,53190,53197,53199,53203-53204,53210-53211,53247,53249,53252,53267,53270,53293,53305,53344,53369,53427,53502-53504,53506,53777,54384,54494,54592,54599-54602,54604,54613,54764,54793,54806,55178

Status & tagging log