summaryrefslogtreecommitdiff
path: root/upload-wiki.pl
blob: d8b31b2be09bca387acd5dd6dd40e4f2228b0c3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<
-rw-r--r--source/fi/reportdesign/uiconfig/dbreport/ui.po20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/fi/reportdesign/uiconfig/dbreport/ui.po b/source/fi/reportdesign/uiconfig/dbreport/ui.po
index 08d3cb35f67..5bcd867643b 100644
--- a/source/fi/reportdesign/uiconfig/dbreport/ui.po
+++ b/source/fi/reportdesign/uiconfig/dbreport/ui.po
@@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED&component=UI\n"
"POT-Creation-Date: 2017-04-19 21:37+0200\n"
-"PO-Revision-Date: 2016-12-31 12:29+0000\n"
+"PO-Revision-Date: 2017-06-29 10:04+0000\n"
"Last-Translator: Harri Pitkänen <hatapitk@iki.fi>\n"
"Language-Team: Finnish <discuss@fi.libreoffice.org>\n"
"Language: fi\n"
@@ -13,8 +13,8 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Accelerator-Marker: ~\n"
-"X-Generator: LibreOffice\n"
-"X-POOTLE-MTIME: 1483187389.000000\n"
+"X-Generator: Pootle 2.8\n"
+"X-POOTLE-MTIME: 1498730665.000000\n"
#: backgrounddialog.ui
msgctxt ""
@@ -626,7 +626,7 @@ msgctxt ""
"label\n"
"string.text"
msgid "_Delete"
-msgstr ""
+msgstr "Poista"
#: navigatormenu.ui
msgctxt ""
@@ -635,7 +635,7 @@ msgctxt ""
"label\n"
"string.text"
msgid "Sorting and Grouping..."
-msgstr ""
+msgstr "Lajittelu ja ryhmittely..."
#: navigatormenu.ui
msgctxt ""
@@ -644,7 +644,7 @@ msgctxt ""
"label\n"
"string.text"
msgid "Page Header/Footer..."
-msgstr ""
+msgstr "Sivun ylä/alatunniste..."
#: navigatormenu.ui
msgctxt ""
@@ -653,7 +653,7 @@ msgctxt ""
"label\n"
"string.text"
msgid "Report Header/Footer..."
-msgstr ""
+msgstr "Raportin ylä/alatunniste..."
#: navigatormenu.ui
msgctxt ""
@@ -662,7 +662,7 @@ msgctxt ""
"label\n"
"string.text"
msgid "New Function"
-msgstr ""
+msgstr "Uusi funktio"
#: navigatormenu.ui
msgctxt ""
@@ -671,7 +671,7 @@ msgctxt ""
"label\n"
"string.text"
msgid "Properties..."
-msgstr ""
+msgstr "Ominaisuudet..."
#: navigatormenu.ui
msgctxt ""
@@ -680,7 +680,7 @@ msgctxt ""
"label\n"
"string.text"
msgid "_Delete"
-msgstr ""
+msgstr "Poista"
#: pagedialog.ui
msgctxt ""
if ( $k eq 'wiki' ) { $url = $v; } elsif ( $k eq 'upload' ) { $upload_url = $v; } elsif ( $k eq 'name' ) { $name = $v; } elsif ( $k eq 'password' ) { $password = $v; } } } close( IN ); if ( !defined( $url ) || !defined( $upload_url ) || !defined( $name ) || !defined( $password ) ) { print "wikisetup.txt does not contain all the info.\n\n"; usage(); } if ( ! -d 'wiki' ) { print "Missing the wiki/ subdir, re-run help-to-wiki.py.\n\n"; usage(); } if ( $upload_images ) { if ( ! -f 'images.txt' ) { print "Missing images.txt, re-run help-to-wiki.py.\n\n"; usage(); } if ( ! -d 'images' ) { print "Missing images/ subdir - mkdir images ; cd images ; unzip /path/to/images_tango.zip\n\n"; usage(); } } $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; # initialize the wiki my $mw = MediaWiki::API->new(); $mw->{config}->{api_url} = $url; $mw->{config}->{upload_url} = $upload_url; # log in to the wiki $mw->login( { lgname => $name, lgpassword => $password } ) || die $mw->{error}->{code} . ': ' . $mw->{error}->{details}; # upload the articles sub upload_article { -f || return; my $pagename = $File::Find::name; $pagename =~ s/^wiki\///; $pagename =~ s/\/MAIN$//; $pagename =~ s/%2F/\//g; # pages starting with lowercase 's' are redirects if ( $pagename =~ /^s/ ) { return if ( !$upload_redirects ); } else { return if ( !$upload_pages ); } my $text = read_file( $_ ); RETRY: print "Uploading page '$pagename'\n"; unless ( $mw->edit( { action => 'edit', title => $pagename, 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/' ); # upload the images if ( $upload_images ) { open( IN, "images.txt" ) || usage(); my $imagename = ''; my $imageuploadmsg = ''; my $image = ''; while ( my $line = <IN> ) { chomp( $line ); my $fname = "images/$line"; if ( ! -f $fname ) { print "Image '$fname' not found, skipped.\n"; next; } if ( ! $fname =~ /\.(png|gif|jpg|jpeg)$/ ) { print "Image '$line' ignored, not a jpg/png/gif.\n"; next; } $imagename = $line; if ( $line =~ /\/([^\/]*)$/ ) { $imagename = $1; } sub upload_file_to_mw { $mw->upload( { title => 'File:'.$imagename, summary => $imageuploadmsg, data => $image } ) || die $mw->{error}->{code} . ': ' . $mw->{error}->{details}; } $image = read_file( $fname ); # don't reupload an image if it is already present - otherwise it only bloats the wiki my $imagesha1 = sha1_hex($image); # get the sha1 request directly from the wiki my $mwquery = $mw->api( { action => 'query', prop => 'imageinfo', iiprop => 'sha1', titles => 'File:'.$imagename } ); my $mwimagesha1 = ""; #FIXME: bad style, this foreach should consist only ONE imageid --> do that nicelier foreach my $imageid (keys $mwquery->{'query'}{'pages'}) { $mwimagesha1 = $mwquery->{'query'}{'pages'}{$imageid}{'imageinfo'}->[0]->{'sha1'}; } if (($imagesha1 ne $mwimagesha1) and ($mwimagesha1 ne '')) { print "Updating image '$imagename', sha1 is different from already uploaded image.\n"; $imageuploadmsg = 'Updating image.'; upload_file_to_mw(); } elsif ($mwimagesha1 eq '') { print "Initial upload of image '$imagename'\n"; $imageuploadmsg = 'Initial upload.'; upload_file_to_mw(); } else { print "Skipping image '$imagename', sha1 identically to already uploaded image.\n"; } } } # clean up $mw->logout(); # vim:set shiftwidth=4 softtabstop=4 expandtab: