diff options
author | Andras Timar <andras.timar@collabora.com> | 2014-02-20 11:55:43 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-02-20 11:55:43 +0100 |
commit | 2539bfabb242613f8ec788e6addcebcca576beee (patch) | |
tree | a41026c4a486c8ff9686bee08cf53653095a666f | |
parent | aa981e2b1df11aebacf2d146ebf24895376324ad (diff) |
Retry wiki page upload on error
Change-Id: I9a9621198d4fc02a03ef94eccdddb481109c73fd
-rwxr-xr-x | upload-wiki.pl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/upload-wiki.pl b/upload-wiki.pl index 8a789444b6..58de4fbe03 100755 --- a/upload-wiki.pl +++ b/upload-wiki.pl @@ -134,11 +134,19 @@ sub upload_article { my $text = read_file( $_ ); + RETRY: print "Uploading page '$pagename'\n"; - $mw->edit( { + if ( $mw->edit( { action => 'edit', title => $pagename, - text => $text }, { skip_encoding => 1 } ) || print 'Error: ' . $mw->{error}->{code} . ': ' . $mw->{error}->{details} . "\n"; + text => $text }, { skip_encoding => 1 } ) ) + { + print 'Error: ' . $mw->{error}->{code} . ': ' . $mw->{error}->{details} . "\n"; + print "Waiting for 10 seconds...\n"; + sleep 10; + print "Retry!\n"; + goto RETRY; + } } File::Find::find( {wanted => \&upload_article}, 'wiki/' ); |