r78356 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78355‎ | r78356 | r78357 >
Date:06:36, 14 December 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Improved error handling for file pushing
Modified paths:
  • /trunk/extensions/Push/Push.i18n.php (modified) (history)
  • /trunk/extensions/Push/Push.php (modified) (history)
  • /trunk/extensions/Push/includes/ext.push.tab.js (modified) (history)
  • /trunk/extensions/Push/specials/ext.push.special.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Push/Push.i18n.php
@@ -53,7 +53,9 @@
5454 'push-tab-no-used-templates' => '(No templates are used on this page.)',
5555 'push-tab-inc-files' => 'Include files',
5656 'push-tab-err-fileinfo' => 'Could not obtain which files are used on this page. None have been pushed.',
57 -
 57+ 'push-tab-err-filepush-unknown' => 'File push failed for an unknown reason.',
 58+ 'push-tab-err-filepush' => 'File push failed: $1',
 59+
5860 // Special page
5961 'special-push' => 'Push pages',
6062 'push-special-description' => 'This page enables you to push content of one or more pages to one or more MediaWiki wikis.
Index: trunk/extensions/Push/specials/ext.push.special.js
@@ -173,17 +173,17 @@
174174 function( data ) {
175175 var fail = false;
176176
177 - for ( i in data.upload ) {
178 - if ( data.error ) {
179 - handleError( pageName, data.error );
 177+ for ( i in data ) {
 178+ if ( data[i].error ) {
 179+ handleError( pageName, { info: mediaWiki.msg( 'push-tab-err-filepush', data[i].error.info ) } );
180180 fail = true;
181181 break;
182182 }
183 - else if ( !data.upload ) {
184 - handleError( pageName, { info: 'Unknown error' } ); // TODO
 183+ else if ( !data[i].upload ) {
 184+ handleError( pageName, { info: mediaWiki.msg( 'push-tab-err-filepush-unknown' ) } );
185185 fail = true;
186 - break;
187 - }
 186+ break;
 187+ }
188188 }
189189
190190 if ( !fail ) {
Index: trunk/extensions/Push/Push.php
@@ -86,6 +86,8 @@
8787 'push-special-obtaining-fileinfo',
8888 'push-special-pushing-file',
8989 'push-tab-err-fileinfo',
 90+ 'push-tab-err-filepush',
 91+ 'push-tab-err-filepush-unknown',
9092 );
9193
9294 // For backward compatibility with MW < 1.17.
Index: trunk/extensions/Push/includes/ext.push.tab.js
@@ -208,22 +208,22 @@
209209 function( data ) {
210210 var fail = false;
211211
212 - for ( i in data.upload ) {
213 - if ( data.error ) {
214 - handleError( sender, targetUrl, data.error );
 212+ for ( i in data ) {
 213+ if ( data[i].error ) {
 214+ handleError( sender, targetUrl, { info: mediaWiki.msg( 'push-tab-err-filepush', data[i].error.info ) } );
215215 fail = true;
216216 break;
217217 }
218 - else if ( !data.upload ) {
219 - handleError( sender, targetUrl, { info: 'Unknown error' } ); // TODO
 218+ else if ( !data[i].upload ) {
 219+ handleError( sender, targetUrl, { info: mediaWiki.msg( 'push-tab-err-filepush-unknown' ) } );
220220 fail = true;
221 - break;
222 - }
 221+ break;
 222+ }
223223 }
224 -
 224+
225225 if ( !fail ) {
226226 sender.innerHTML = mediaWiki.msg( 'push-button-completed' );
227 - setTimeout( function() {reEnableButton( sender, targetUrl, targetName );}, 1000 );
 227+ setTimeout( function() {reEnableButton( sender, targetUrl, targetName );}, 1000 );
228228 }
229229 }
230230 );

Status & tagging log