[Libreoffice-commits] help.git: 2 commits - upload-wiki.pl

Andras Timar andras.timar at collabora.com
Thu Feb 20 03:33:17 PST 2014


 upload-wiki.pl |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 2539bfabb242613f8ec788e6addcebcca576beee
Author: Andras Timar <andras.timar at collabora.com>
Date:   Thu Feb 20 11:55:43 2014 +0100

    Retry wiki page upload on error
    
    Change-Id: I9a9621198d4fc02a03ef94eccdddb481109c73fd

diff --git a/upload-wiki.pl b/upload-wiki.pl
index 8a78944..58de4fb 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/' );
 
commit aa981e2b1df11aebacf2d146ebf24895376324ad
Author: Andras Timar <andras.timar at collabora.com>
Date:   Thu Feb 20 11:08:03 2014 +0100

    line break instead of literal \n
    
    Change-Id: I0617304a7523ab06b862bdca108265b8ea969ab6

diff --git a/upload-wiki.pl b/upload-wiki.pl
index 4dd63bf..8a78944 100755
--- a/upload-wiki.pl
+++ b/upload-wiki.pl
@@ -138,7 +138,7 @@ sub upload_article {
     $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";
 }
 File::Find::find( {wanted => \&upload_article}, 'wiki/' );
 


More information about the Libreoffice-commits mailing list