summaryrefslogtreecommitdiff
path: root/wikiscraper.pl
blob: 7da198f5dab4e7ac3d314550a9009bc21f7882ca (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
#!/usr/bin/perl

# MediaWiki -> RCS scraper

use warnings;
use strict;

require MediaWiki::DumpFile::Pages;

my $dumpfile = MediaWiki::DumpFile::Pages->new(shift @ARGV);
# 83Plus:Ports:57

while (defined (my $page = $dumpfile->next))
{
    my @revs = $page->revision;

    foreach (@revs) {
	open (FILE, ">", $page->title);
	print FILE $_->text;
	close FILE;
	my @command = ("ci",
		       "-t-" . $page->title,
		       "-d" . $_->timestamp,
		       ($_->comment ne "" ? "-m" . $_->comment : "-mNo message"),
		       "-r" . $_->id,
		       "-w" . $_->contributor->astext,
		       "-l",
		       $page->title,
	    );

	system(@command);
	print join " ", @command, "\n";
    }
}