Index: trunk/extensions/LocalisationUpdate/LocalisationUpdate.php |
— | — | @@ -21,4 +21,6 @@ |
22 | 22 | $dir = dirname( __FILE__ ) . '/'; |
23 | 23 | $wgExtensionMessagesFiles['LocalisationUpdate'] = $dir . 'LocalisationUpdate.i18n.php'; |
24 | 24 | $wgAutoloadClasses['LocalisationUpdate'] = $dir . 'LocalisationUpdate.class.php'; |
25 | | -$wgHooks['LoadExtensionSchemaUpdates'][] = 'LocalisationUpdate::schemaUpdates'; |
\ No newline at end of file |
| 25 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'LocalisationUpdate::schemaUpdates'; |
| 26 | + |
| 27 | +$wgLocalisationUpdateRetryAttempts = 5; |
\ No newline at end of file |
Index: trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | |
46 | 46 | // Update all Extension messages |
47 | 47 | foreach ( $wgExtensionMessagesFiles as $extension => $locFile ) { |
48 | | - $result = self::updateExtensionMessages( $locFile, $extension, $verbose ); |
| 48 | + $result += self::updateExtensionMessages( $locFile, $extension, $verbose ); |
49 | 49 | } |
50 | 50 | |
51 | 51 | // And output the result! |
— | — | @@ -168,14 +168,21 @@ |
169 | 169 | } |
170 | 170 | |
171 | 171 | public static function getFileContents( $basefile ) { |
| 172 | + global $wgLocalisationUpdateRetryAttempts; |
| 173 | + $attempts = 0; |
172 | 174 | $basefilecontents = ""; |
173 | 175 | // use cURL to get the SVN contents |
174 | 176 | if ( preg_match( "/^http/", $basefile ) ) { |
175 | | - $basefilecontents = Http::get( $basefile ); |
176 | | - if ( empty( $basefilecontents ) ) { |
177 | | - self::myLog( "Cannot get the contents of " . $basefile . " (curl)" ); |
178 | | - return false; |
| 177 | + while(empty($basefilecontents) && $attempts < $wgLocalisationUpdateRetryAttempts) { |
| 178 | + if($attempts > 0) |
| 179 | + sleep(1); |
| 180 | + $basefilecontents = Http::get( $basefile ); |
| 181 | + $attempts++; |
179 | 182 | } |
| 183 | + if ( empty( $basefilecontents ) ) { |
| 184 | + self::myLog( "Cannot get the contents of " . $basefile . " (curl)" ); |
| 185 | + return false; |
| 186 | + } |
180 | 187 | } else {// otherwise try file_get_contents |
181 | 188 | if ( !$basefilecontents = file_get_contents( $basefile ) ) { |
182 | 189 | self::myLog( "Cannot get the contents of " . $basefile ); |