Revision: 4058 Author: misza13 Date: 2007-08-17 13:19:18 +0000 (Fri, 17 Aug 2007)
Log Message: ----------- Added two new configuration options: * minthreadsleft (default: 5) - the minimum number of threads that should be left on a page (to prevent pages from getting completely harvested) * minthreadstoarchive (default: 2) - the minimum number of threads to archive at one time (lowers edit frequency)
Modified Paths: -------------- trunk/pywikipedia/archivebot.py
Modified: trunk/pywikipedia/archivebot.py =================================================================== --- trunk/pywikipedia/archivebot.py 2007-08-17 09:31:29 UTC (rev 4057) +++ trunk/pywikipedia/archivebot.py 2007-08-17 13:19:18 UTC (rev 4058) @@ -321,6 +321,8 @@ T = time.mktime(time.gmtime()) whys = [] for t in oldthreads: + if len(oldthreads) - self.archivedThreads <= self.get('minthreadsleft',5): + break #Because there's too little threads left. #TODO: Make an option so that unstamped (unsigned) posts get archived. why = t.shouldBeArchived(self) if why: @@ -345,8 +347,10 @@
def run(self): whys = self.analyzePage() + if self.archivedThreads < self.get('minthreadstoarchive',2): + return #We might not want to archive a measly few threads (lowers edit frequency) if whys: - #Save the archives first (so that bugs don't cause a loss of data + #Save the archives first (so that bugs don't cause a loss of data) for a in sorted(self.archives.keys()): self.commentParams['count'] = self.archives[a].archivedThreads comment = self.archiveSummary % self.commentParams
pywikipedia-l@lists.wikimedia.org