]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/doc/wiki-upload.pl
Enable ehternet for all platform
[pes-rpp/rpp-lib.git] / rpp / doc / wiki-upload.pl
1 #!/usr/bin/perl -w
2
3 use MediaWiki::API;
4
5 my $mw = MediaWiki::API->new();
6 $mw->{config}->{api_url} = 'https://rtime.felk.cvut.cz/rpp/api.php';
7
8 $wikiLogin = undef;
9 $wikiPassword = undef;
10 1;
11 do '.wiki.pl'; # Read login and password from another file (copy the
12                # above three lines there)
13
14 # log in to the wiki
15 $mw->login( { lgname => $wikiLogin, lgpassword => $wikiPassword } )
16     || die $mw->{error}->{code} . ': ' . $mw->{error}->{details};
17
18 my $filename = $ARGV[0];
19
20 my $success = $mw->edit(
21     {
22         action   => 'upload',
23         filename => $filename,
24         comment  => "Uploaded by $0",
25         file     => [$filename],
26         ignorewarnings => 1,
27     })
28     || die $mw->{error}->{code} . ': ' . $mw->{error}->{details};
29
30 # use Data::Dumper;
31 # print Dumper($mw->{response}->{_content});
32
33 $mw->logout();