http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10829
Revision: 10829 Author: btongminh Date: 2012-12-24 11:07:46 +0000 (Mon, 24 Dec 2012) Log Message: ----------- Store the last read deletion entry in a file, if set in the config
Modified Paths: -------------- trunk/pywikipedia/commonsdelinker/delinker.py
Modified: trunk/pywikipedia/commonsdelinker/delinker.py =================================================================== --- trunk/pywikipedia/commonsdelinker/delinker.py 2012-12-23 20:59:00 UTC (rev 10828) +++ trunk/pywikipedia/commonsdelinker/delinker.py 2012-12-24 11:07:46 UTC (rev 10829) @@ -681,6 +681,14 @@ config.sysopnames = dict([(fam, {}) for fam in config.sysopnames.keys()])
self.last_check = time.time() + if 'deletion_log_store' in self.config: + last_check = int(open(self.config['deletion_log_store'], 'r').read()) + if (last_check > self.last_check) or (self.last_check - last_check) > \ + self.config.get('max_session_restore_time', 3600): + output(u'Not restoring last session; delta: %i' % (self.last_check - last_check)) + else: + self.last_check = last_check + output(u'Restoring last session ended at %i' % self.last_check)
#if 'bot' in self.site.userGroups: # self.log_limit = '5000' @@ -886,10 +894,16 @@ self.Delinkers.exit() self.Loggers.exit() output(u'All work done; exiting') - return + break
time.sleep(self.config['timeout']) + + # Store the last time the deletion log was checked + if 'deletion_log_store' in self.config: + open(self.config['deletion_log_store'], 'w').write(str(self.last_check)) + output(u'Storing session end at %i' % self.last_check)
+ def thread_died(self): # Obsolete return
pywikipedia-svn@lists.wikimedia.org