Dalba has uploaded a new change for review.
https://gerrit.wikimedia.org/r/267216
Change subject: spamremove.py: Provide -summary and -protocol options
......................................................................
spamremove.py: Provide -summary and -protocol options
Allow users to override the default protocol ('http') and summary.
Bug: T57021
Change-Id: I589b2f16d9ef5a5e16118c9a3bbca868c5721bf0
---
M scripts/spamremove.py
1 file changed, 17 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/16/267216/1
diff --git a/scripts/spamremove.py b/scripts/spamremove.py
index 246e5c1..4ef44e3 100755
--- a/scripts/spamremove.py
+++ b/scripts/spamremove.py
@@ -20,6 +20,8 @@
-namespace: Filters the search to a given namespace. If this is specified
multiple times it will search all given namespaces
+-protocol: Default is "http".
+-summary: The summary to be used instead of the default summary.
"""
#
@@ -53,6 +55,8 @@
always = False
namespaces = []
spamSite = ''
+ protocol = 'http'
+ summary = None
for arg in pywikibot.handle_args(args):
if arg == "-always":
always = True
@@ -61,6 +65,10 @@
namespaces.append(int(arg[len('-namespace:'):]))
except ValueError:
namespaces.append(arg[len('-namespace:'):])
+ elif arg.startswith('-protocol:'):
+ protocol = arg.partition(':')[2]
+ elif arg.startswith('-summary:'):
+ summary = arg.partition(':')[2]
else:
spamSite = arg
@@ -69,10 +77,16 @@
return False
mysite = pywikibot.Site()
- pages = mysite.exturlusage(spamSite, namespaces=namespaces, content=True)
+ pages = mysite.exturlusage(
+ spamSite, protocol=protocol, namespaces=namespaces, content=True
+ )
- summary = i18n.twtranslate(mysite, 'spamremove-remove',
- {'url': spamSite})
+ if not summary:
+ summary = i18n.twtranslate(
+ mysite,
+ 'spamremove-remove',
+ {'url': spamSite}
+ )
for i, p in enumerate(pages, 1):
text = p.text
if spamSite not in text:
--
To view, visit https://gerrit.wikimedia.org/r/267216
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I589b2f16d9ef5a5e16118c9a3bbca868c5721bf0
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits