Revision: 5070 Author: btongminh Date: 2008-02-22 14:01:55 +0000 (Fri, 22 Feb 2008)
Log Message: ----------- image_replacer.py: Add rate limitter. delinker.txt: Fix indices.
Modified Paths: -------------- trunk/pywikipedia/commonsdelinker/delinker.txt trunk/pywikipedia/commonsdelinker/image_replacer.py
Modified: trunk/pywikipedia/commonsdelinker/delinker.txt =================================================================== --- trunk/pywikipedia/commonsdelinker/delinker.txt 2008-02-22 13:13:08 UTC (rev 5069) +++ trunk/pywikipedia/commonsdelinker/delinker.txt 2008-02-22 14:01:55 UTC (rev 5070) @@ -167,7 +167,8 @@ comment VARBINARY(255), PRIMARY KEY(id), - INDEX(status) + INDEX (timestamp, old_image, new_image) + INDEX (status) ); </code>
Modified: trunk/pywikipedia/commonsdelinker/image_replacer.py =================================================================== --- trunk/pywikipedia/commonsdelinker/image_replacer.py 2008-02-22 13:13:08 UTC (rev 5069) +++ trunk/pywikipedia/commonsdelinker/image_replacer.py 2008-02-22 14:01:55 UTC (rev 5070) @@ -102,6 +102,7 @@ replacements = self.template.finditer(text) remove_from_list = [] + count = 0 for replacement in replacements: res = self.examine_revision_history( revisions, replacement, username) @@ -110,6 +111,8 @@ self.cursor.execute(insert, res) remove_from_list.append(replacement.group(0)) output('Replacing %s by %s: %s' % replacement.groups()) + count += 1 + if count == self.config.get('replacement_rate_limit', -1): break self.database.commit() if remove_from_list and self.config.get('clean_list', False):
pywikipedia-l@lists.wikimedia.org