r92536 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92535‎ | r92536 | r92537 >
Date:14:37, 19 July 2011
Author:ariel
Status:deferred
Tags:
Comment:
copy over partial md5 results after every job, so users who download files before the entire dump is done can check file integrity
Modified paths:
  • /branches/ariel/xmldumps-backup/worker.py (modified) (history)

Diff [purge]

Index: branches/ariel/xmldumps-backup/worker.py
@@ -747,6 +747,13 @@
748748 realFileName = self._getChecksumFileName()
749749 os.rename(tmpFileName, realFileName)
750750
 751+ def cpMd5TmpFileToPermFile(self):
 752+ if (self._enabled):
 753+ tmpFileName = self._getChecksumFileNameTmp()
 754+ realFileName = self._getChecksumFileName()
 755+ text = FileUtils.readFile(tmpFileName)
 756+ FileUtils.writeFile(self._getMd5FileDirName(), realFileName, text, self.wiki.config.fileperms)
 757+
751758 def getChecksumFileNameBasename(self):
752759 return ("md5sums.txt")
753760
@@ -780,6 +787,9 @@
781788 checksum = self._md5FileLine(path)
782789 output.write(checksum)
783790
 791+ def _getMd5FileDirName(self):
 792+ return os.path.join(self.wiki.publicDir(), self.wiki.date);
 793+
784794 class DumpDir(object):
785795 def __init__(self, wiki, dbName, date):
786796 self._wiki = wiki
@@ -1281,6 +1291,7 @@
12821292 else:
12831293 if not self.dryrun and not self._chunkToDo:
12841294 self.runUpdateItemFileInfo(item)
 1295+ self.checksums.cpMd5TmpFileToPermFile()
12851296 self.lastFailed = False
12861297
12871298 self.status.updateStatusFiles("done")

Status & tagging log