Python talk:RevertAll.py

From Botwiki

Jump to: navigation, search

testing: see special:contributions/hillgentleman, [1] (sysop)

         and special:contributions/hillgentleman1 (vandal)


Contents

[edit] hints for using this script

- or, rather, rough draft

  1. install pywikipedia.
  2. login
  3. set your user-config.py to your target wiki, use your sysop account if you can
  4. get yourself a copy of python:userContributions.py while stock lasts
  5. get yourself a copy of revertAll.py
  6. customise, i.e. fix the parameters in revertAll.py, as much as you can
    1. in particular, set up the regex (or just the pagemoveWord) according to your mediawiki:1movedto2
  7. try to run it, it should be safe - with plenty of clues and throttles
  8. fix the errors
  9. etc

checking the comment is a possible but not the best place to detect a pagemove. Is there a better way? It seems that the value "title" doesn't help. Hillgentleman 16:16, 26 November 2007 (UTC)

Even looking for redirecting page(s) is not foul-proof. A solution is to ask for manual input (ie asking "Move it back? (Y)es, (N)o, (A)ll") for all potential page-moves (or the opposite, ask what not to be moved) before the act. . Hillgentleman 05:20, 28 November 2007 (UTC)
In any case this should not be a serious issue, for multi-stage page-moves are slow and costly. Hillgentleman 06:56, 28 November 2007 (UTC)
This should be done off Special:Log/move for accuracy and bandwidth and ease of processing. Mike.lifeguard | @meta 04:02, 24 January 2008 (UTC)
Great. Then we should write a python:userMoveLog.py or we may put all of these into a User class in a python:user.py. Hillgentleman 05:01, 25 January 2008 (UTC)

[edit] wikipedia.Page.move()

def move(self, newtitle, reason=None, movetalkpage=True, sysop=False,
             throttle=True):

So the command here should be:

page.move( originalTitle, 'moving the page [[' + title + ']] back to' + originalTitle + ']], before the move by [[user:' + vandalName + ']], the edit of ' + userName + ' at the time ' + timestamp, True, True, True)

Unless the user is not sysop, then sysop=False.

[edit] wikipedia.Page.delete()

def delete(self, reason=None, prompt=True, throttle=True):

So the command here should be:

page.delete('deleting mass spam by ' + vandalName, prompt) #  let the user set the truth of "prompt", but the default should be False


[edit] it kind of works

- even with a lot of (unimportant) error messages.

But I need to find out why it stopped the pagemove at crap2, and had not gone all the way to stuff Perhaps it is becaues crap1 was not deleted. But why did it fail to delete crap1? And is it better to write and use a "delete and move" function? Hillgentleman 02:40, 30 November 2007 (UTC)

It finished the job in the second run. Why? Was it a temporary network glitch that the deletion of crap1 failed in the first run? Or is there a stupid bug, due to my lousy coding (ie lack of error detection) ? Hillgentleman 02:49, 30 November 2007 (UTC)


# 02:34, 30 November 2007 (hist) (diff) CrapDrei‎ (CrapDrei moved to Crap2: bot-moving (see botwiki:python:revertAll.py), reversing the contribution of user:Hillgentleman1)  (top) [rollback]
# 02:34, 30 November 2007 (hist) (diff) m Crap2‎ (CrapDrei moved to Crap2: bot-moving (see botwiki:python:revertAll.py), reversing the contribution of user:Hillgentleman1) (top) [rollback]
# 02:34, 30 November 2007 (hist) (diff) CrapQuatre‎ (CrapQuatre moved to CrapDrei: bot-moving (see botwiki:python:revertAll.py), reversing the contribution of user:Hillgentleman1) (top) [rollback]
# 02:34, 30 November 2007 (hist) (diff) m Crap2‎ (CrapQuatre moved to CrapDrei: bot-moving (see botwiki:python:revertAll.py), reversing the contribution of user:Hillgentleman1)
# 02:33, 30 November 2007 (hist) (diff) CrapNm‎ (CrapNm moved to CrapQuatre: bot-moving (see botwiki:python:revertAll.py), reversing the contribution of user:Hillgentleman1) (top) [rollback]
# 02:33, 30 November 2007 (hist) (diff) m Crap2‎ (CrapNm moved to CrapQuatre: bot-moving (see botwiki:python:revertAll.py), reversing the contribution of user:Hillgentleman1) 

[edit] Idea

Just to drop an idea, if it would be possible, it would be great to revert only edits that match a certain regex as summary. Snowolf how can I help? 01:46, 20 December 2007 (UTC)

THAT SHOULD NOT BE DIFFICULT. I HAVEN'T TOUCHED IT FOR A WHILE, BUT I THINK WE CAN USE THE REGEX TO BREAK THE LOOP AFTER for time, userName, content in edits:. FOR EXAMPLE, if vandalRegex.findall(comment)==[]: continue Hillgentleman 03:00, 24 January 2008 (UTC)
Personal tools