Repository navigation
Expand file tree
/
Copy pathcleanup_again.plx
More file actions
executable file
·86 lines (64 loc) · 1.67 KB
/
Copy pathcleanup_again.plx
File metadata and controls
executable file
·86 lines (64 loc) · 1.67 KB
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
#!/usr/local/bin/perl -w
#!/usr/bin/perl -w
## This is a 'cleanup' script, written as part of the migration
## process from the old MetaBase to the latest version.
use strict;
use Getopt::Long;
use MediaWiki::API;
## Import the helper functions
use NARDatabase
( "mwLogin",
"getPageStatus",
"getPageRevisions"
);
## Get a connection to the wiki...
my $mw = mwLogin;
## Check the command line for command line arguments
# For debugging
my $force = 0;
my $verbose = 0;
GetOptions( "force" => \$force,
"verbose+" => \$verbose,
)
or die "problem with command line arguments\n";
## List based on template usage
my $list =
$mw->list ( { action => 'query',
list => 'embeddedin',
eititle => 'Template:NARDatabase transclusion',
eilimit => '250'
},
{ max => 4 }
);
print "got ", scalar(@$list), "\n";
for my $page (@$list){
my $title = $page->{title};
## Historical fix up!!!!!
my $rev = getPageRevisions($title, $mw)
or die "ffffff\n";
if($force ||
(scalar(@$rev) == 3 &&
$rev->[0]->{user} eq 'MaintainanceBot' &&
$rev->[1]->{user} eq 'NARDatabaseBot' &&
$rev->[2]->{user} eq 'NARDatabaseBot'
) ||
(scalar(@$rev) == 4 &&
$rev->[0]->{user} eq 'MaintainanceBot' &&
$rev->[1]->{user} eq 'MaintainanceBot' &&
$rev->[2]->{user} eq 'NARDatabaseBot' &&
$rev->[3]->{user} eq 'NARDatabaseBot'
) ||
(scalar(@$rev) == 2 &&
$rev->[0]->{user} eq 'NARDatabaseBot' &&
$rev->[1]->{user} eq 'NARDatabaseBot'
) ||
(scalar(@$rev) == 1 &&
$rev->[0]->{user} eq 'MaintainanceBot'
)
){
print "$title\n"
}
else{
#nop
}
}