jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/472864 )

Change subject: [IMPR] Allow use of action=purge API parameters
......................................................................

[IMPR] Allow use of action=purge API parameters

Add options to use forcelinkupdate, forcerecursivelinkupdate, redirects,
and converttitles.

Change-Id: I607304403ded6eedc7d89885c1aecc9fe379e25c
---
M scripts/touch.py
1 file changed, 27 insertions(+), 5 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/touch.py b/scripts/touch.py
index 48ba7f6..24f5605 100755
--- a/scripts/touch.py
+++ b/scripts/touch.py
@@ -10,8 +10,17 @@

 &params;

--purge            Do not touch but purge the page
--botflag          Force botflag in case of edits with changes.
+-purge                    Do not touch but purge the page
+
+Touch arguments:
+-botflag                  Force botflag in case of edits with changes.
+
+Purge arguments:
+-converttitles            Convert titles to other variants if necessary
+-forcelinkupdate          Update the links tables
+-forcerecursivelinkupdate Update the links table, and update the links tables
+                          for any page that uses this page as a template
+-redirects                Automatically resolve redirects

 """
 #
@@ -62,10 +71,22 @@

     """Purge each page on the generator."""

+    def __init__(self, generator, **kwargs):
+        """Initialize a PurgeBot instance with the options and generator."""
+        self.availableOptions = {
+            'converttitles': None,
+            'forcelinkupdate': None,
+            'forcerecursivelinkupdate': None,
+            'redirects': None
+        }
+        super(PurgeBot, self).__init__(generator=generator, **kwargs)
+
     def treat(self, page):
         """Purge the given page."""
         pywikibot.output('Page {0}{1} purged'.format(
-            page.title(as_link=True), '' if page.purge() else ' not'))
+            page.title(as_link=True),
+            '' if page.purge(**self.options) else ' not'
+        ))


 def main(*args):
@@ -86,14 +107,15 @@

     bot_class = TouchBot
     for arg in local_args:
+        if gen_factory.handleArg(arg):
+            continue
         if arg == '-purge':
             bot_class = PurgeBot
         elif arg == '-redir':
             issue_deprecation_warning(
                 '\n-redir', None, 1, ArgumentDeprecationWarning,
                 since='20150514')
-        elif not gen_factory.handleArg(arg) and arg.startswith('-'):
-            # -botflag
+        elif arg.startswith('-'):
             options[arg[1:].lower()] = True

     gen = gen_factory.getCombinedGenerator(preload=True)

--
To view, visit https://gerrit.wikimedia.org/r/472864
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I607304403ded6eedc7d89885c1aecc9fe379e25c
Gerrit-Change-Number: 472864
Gerrit-PatchSet: 7
Gerrit-Owner: JJMC89 <[email protected]>
Gerrit-Reviewer: Framawiki <[email protected]>
Gerrit-Reviewer: JJMC89 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: D3r1ck01 <[email protected]>
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to