Skip to content

Commit 0ec2c9c

Browse files
committed
less log messages
1 parent 0b3630a commit 0ec2c9c

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

fixattackpages_deletionpedia.pl

+17-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,22 @@
88
sub EditPage {
99
my $mw=shift;
1010
my $pagename = shift;
11-
$mw->edit( {
12-
action => 'delete', title => $pagename, reason => 'Attack Pages' } )
13-
|| warn $mw->{error}->{code} . ': ' . $mw->{error}->{details};
11+
my $ok =$mw->edit( { action => 'delete', title => $pagename, reason => 'Attack Pages' } ) ;
12+
13+
if ($ok) {
14+
warn "$pagename deleted\n";
15+
} else {
16+
if (
17+
($mw->{error}->{code} != 5)
18+
&&
19+
($mw->{error}->{code} != 3)
20+
)
21+
{ #Page does not exist
22+
warn $mw->{error}->{code} . ': ' . $mw->{error}->{details} ;
23+
}
24+
25+
}
26+
1427

1528
}
1629

@@ -59,7 +72,7 @@ sub GetPages {
5972

6073
# and print the article titles
6174
foreach (@{$articles}) {
62-
print "going to delete $_->{title}\n";
75+
#print "going to delete $_->{title}\n";
6376
EditPage $mw2, $_->{title};
6477
}
6578
}

speedydeletion.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def signal_handler(signal, frame):
1919
signal.signal(signal.SIGINT, signal_handler)
2020

2121

22+
import subprocess
2223

2324
def main(*args):
2425
genFactory = pagegenerators.GeneratorFactory()
@@ -35,8 +36,6 @@ def main(*args):
3536
importsite = "speedydeletion"
3637
outsite = pywikibot.getSite("en",importsite)
3738
outsite.forceLogin()
38-
dump = xmlreader.XmlDump(xmlfilename)
39-
count = 0
4039

4140
try :
4241
print "try to open %s\n" % xmlfilename
@@ -45,6 +44,14 @@ def main(*args):
4544
print "cannot open %s\n" % xmlfilename
4645
exit (0)
4746

47+
tempfile = "%s.tmp" % xmlfilename
48+
49+
status = subprocess.call("xmllint --recover %s -o %s" % (xmlfilename,tempfile) , shell=True)
50+
print "status %d\n" % status
51+
52+
dump = xmlreader.XmlDump(tempfile)
53+
count = 0
54+
4855
for entry in dump.parse():
4956
# print file_store[entry.title]
5057
title=entry.title.encode("utf8","ignore")

0 commit comments

Comments
 (0)