Index: branches/wmf-deployment/extensions/LocalisationUpdate/update.php |
— | — | @@ -12,23 +12,22 @@ |
13 | 13 | print "\n"; |
14 | 14 | print "Usage: php extensions/LocalisationUpdate/update.php\n"; |
15 | 15 | 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"; |
18 | 20 | print "\n"; |
19 | 21 | exit( 0 ); |
20 | 22 | } |
21 | 23 | |
22 | 24 | |
23 | | -$verbose = !isset( $options['quiet'] ); |
24 | | -$all = isset( $options['all'] ); |
25 | | - |
26 | 25 | $starttime = microtime( true ); |
27 | 26 | |
28 | 27 | // Prevent the script from timing out |
29 | 28 | set_time_limit( 0 ); |
30 | 29 | ini_set( "max_execution_time", 0 ); |
31 | 30 | |
32 | | -LocalisationUpdate::updateMessages( $verbose, $all ); |
| 31 | +LocalisationUpdate::updateMessages( $options ); |
33 | 32 | |
34 | 33 | $endtime = microtime( true ); |
35 | 34 | $totaltime = ( $endtime - $starttime ); |
Index: branches/wmf-deployment/extensions/LocalisationUpdate/LocalisationUpdate.class.php |
— | — | @@ -18,29 +18,42 @@ |
19 | 19 | } |
20 | 20 | |
21 | 21 | // 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 | + |
23 | 28 | // Update all MW core messages |
24 | | - $result = self::updateMediawikiMessages( $verbose ); |
| 29 | + if( !$skipCore ) { |
| 30 | + $result = self::updateMediawikiMessages( $verbose ); |
| 31 | + } |
25 | 32 | |
26 | 33 | // 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 | + } |
36 | 49 | } |
| 50 | + } else { |
| 51 | + global $wgExtensionMessagesFiles; |
| 52 | + $extFiles = $wgExtensionMessagesFiles; |
37 | 53 | } |
38 | | - } else { |
39 | | - global $wgExtensionMessagesFiles; |
40 | | - $extFiles = $wgExtensionMessagesFiles; |
| 54 | + foreach ( $extFiles as $extension => $locFile ) { |
| 55 | + $result += self::updateExtensionMessages( $locFile, $extension, $verbose ); |
| 56 | + } |
41 | 57 | } |
42 | | - foreach ( $extFiles as $extension => $locFile ) { |
43 | | - $result += self::updateExtensionMessages( $locFile, $extension, $verbose ); |
44 | | - } |
45 | 58 | |
46 | 59 | // And output the result! |
47 | 60 | self::myLog( "Updated {$result} messages in total" ); |
Property changes on: branches/wmf-deployment/extensions/LocalisationUpdate |
___________________________________________________________________ |
Name: svn:mergeinfo |
48 | 61 | - /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 |
49 | 62 | + /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 |