r12940 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12939‎ | r12940 | r12941 >
Date:01:45, 3 February 2006
Author:vibber
Status:old
Tags:
Comment:
Put stub files in local /tmp directory; having mysterious failures sometimes loading them over nfs
Modified paths:
  • /trunk/backup/WikiBackup.py (modified) (history)

Diff [purge]

Index: trunk/backup/WikiBackup.py
@@ -122,7 +122,8 @@
123123
124124 def __init__(self, public, private, dblist, privatelist, dbserver,
125125 dbuser, dbpassword, wikidir, php="php", webroot="",
126 - template=dirname(realpath(sys.modules[__module__].__file__))):
 126+ template=dirname(realpath(sys.modules[__module__].__file__)),
 127+ tmp="/tmp"):
127128 self.public = public
128129 self.private = private
129130 self.dblist = dblist
@@ -134,6 +135,7 @@
135136 self.php = php
136137 self.webroot = webroot
137138 self.template = template
 139+ self.tmp = tmp
138140 self.db = None
139141 self.date = None
140142 self.failcount = 0
@@ -188,6 +190,10 @@
189191 """
190192 return self.buildPath(self.publicDir(), self.date, filename)
191193
 194+ def tmpPath(self, filename):
 195+ """Return a filename in the temporary directory based on the given name."""
 196+ return join(self.tmp, self.db + "-tmp-" + filename)
 197+
192198 def latestPath(self, filename):
193199 return self.buildPath(self.latestDir(), "latest", filename)
194200
@@ -624,6 +630,12 @@
625631 return "creating split stub dumps..."
626632
627633 def run(self, runner):
 634+ history = runner.tmpPath("stub-meta-history.xml.gz")
 635+ current = runner.tmpPath("stub-meta-current.xml.gz")
 636+ articles = runner.tmpPath("stub-articles.xml.gz")
 637+ for filename in (history, current, articles):
 638+ if exists(filename):
 639+ remove(filename)
628640 command = """
629641 %s -q %s/maintenance/dumpBackup.php %s \
630642 --full \
@@ -639,9 +651,9 @@
640652 runner.php,
641653 runner.wikidir,
642654 runner.db,
643 - runner.privatePath("stub-meta-history.xml.gz"),
644 - runner.privatePath("stub-meta-current.xml.gz"),
645 - runner.privatePath("stub-articles.xml.gz")))
 655+ history,
 656+ current,
 657+ articles))
646658 runner.runCommand(command)
647659
648660 class XmlDump(Dump):
@@ -680,7 +692,7 @@
681693 """Build the command line for the dump, minus output and filter options"""
682694
683695 # Page and revision data pulled from this skeleton dump...
684 - stub = runner.privatePath("stub-%s.xml.gz" % self._subset),
 696+ stub = runner.tmpPath("stub-%s.xml.gz" % self._subset),
685697 stubOption = "--stub=gzip:%s" % stub
686698
687699 # Try to pull text from the previous run; most stuff hasn't changed

Status & tagging log