r51000 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50999‎ | r51000 | r51001 >
Date:03:35, 26 May 2009
Author:tomasz
Status:deferred (Comments)
Tags:
Comment:
Bug fix for #18808. Moving XmlLogging into it's own class for clarity. Removing broken logging job. Also cleaning up any tab/space/whitespace issues
Modified paths:
  • /trunk/backup/worker.py (modified) (history)

Diff [purge]

Index: trunk/backup/worker.py
@@ -246,9 +246,7 @@
247247 XmlDump("meta-current",
248248 "All pages, current versions only.",
249249 "Discussion and user pages are included in this complete archive. Most mirrors won't want this extra material."),
250 - XmlDump("logging",
251 - "<big><b>Log events to all pages.</b></big>",
252 - "This contains the log of actions performed on pages.")]
 250+ XmlLogging("Pull out all logging data")]
253251
254252 if not self.wiki.isBig():
255253 self.items.append(
@@ -341,13 +339,13 @@
342340
343341 def saveStatus(self, items, done=False):
344342 """Write out an HTML file with the status for this wiki's dump and links to completed files."""
345 - try:
346 - self.wiki.writeIndex(self.reportStatus(items, done))
347 -
348 - # Short line for report extraction
349 - self.wiki.writeStatus(self.reportDatabase(items, done))
350 - except:
351 - print "Couldn't update status files. Continuing anyways"
 343+ try:
 344+ self.wiki.writeIndex(self.reportStatus(items, done))
 345+
 346+ # Short line for report extraction
 347+ self.wiki.writeStatus(self.reportDatabase(items, done))
 348+ except:
 349+ print "Couldn't update status files. Continuing anyways"
352350
353351 def progressReports(self):
354352 status = {}
@@ -442,13 +440,14 @@
443441 html += "</li>"
444442 return html
445443
 444+ # Report on the file size & status of the current output and output a link if were done
446445 def reportFile(self, file, status):
447446 filepath = self.publicPath(file)
448 - if status == "in-progress" and exists (filepath):
449 - size = prettySize(getsize(filepath))
450 - return "<li class='file'>%s %s (written) </li>" % (file, size)
451 - elif status == "done" and exists(filepath):
 447+ if status == "in-progress" and exists (filepath):
452448 size = prettySize(getsize(filepath))
 449+ return "<li class='file'>%s %s (written) </li>" % (file, size)
 450+ elif status == "done" and exists(filepath):
 451+ size = prettySize(getsize(filepath))
453452 webpath = self.webPath(file)
454453 return "<li class='file'><a href=\"%s\">%s</a> %s</li>" % (webpath, file, size)
455454 else:
@@ -644,15 +643,13 @@
645644 def listFiles(self, runner):
646645 return ["stub-meta-history.xml.gz",
647646 "stub-meta-current.xml.gz",
648 - "stub-articles.xml.gz",
649 - "logging.xml.gz"]
 647+ "stub-articles.xml.gz",]
650648
651649 def run(self, runner):
652650 history = runner.publicPath("stub-meta-history.xml.gz")
653651 current = runner.publicPath("stub-meta-current.xml.gz")
654652 articles = runner.publicPath("stub-articles.xml.gz")
655 - logging = runner.publicPath("logging.xml.gz")
656 - for filename in (history, current, articles, logging):
 653+ for filename in (history, current, articles):
657654 if exists(filename):
658655 os.remove(filename)
659656 command = """
@@ -679,7 +676,24 @@
680677 history,
681678 current,
682679 articles))
683 - runner.runCommand(command)
 680+ runner.runCommand(command, callback=self.progressCallback)
 681+
 682+class XmlLogging(Dump):
 683+ """ Create a logging dump of all page activity """
 684+
 685+ def description(self):
 686+ return "<big><b>Log events to all pages.</big></b>"
 687+
 688+ def detail(self):
 689+ return "This contains the log of actions performed on pages."
 690+
 691+ def listFiles(self, runner):
 692+ return ["pages-logging.xml.gz"]
 693+
 694+ def run(self, runner):
 695+ logging = runner.publicPath("pages-logging.xml.gz")
 696+ if exists(logging):
 697+ os.remove(logging)
684698 command = """
685699 %s -q %s/maintenance/dumpBackup.php \
686700 --wiki=%s \
@@ -837,14 +851,15 @@
838852 # Clear prior 7zip attempts; 7zip will try to append an existing archive
839853 if exists(xml7z):
840854 os.remove(xml7z)
841 -
842 - # temp hack force 644 permissions until ubuntu bug # 370618 is fixed - tomasz 5/1/2009
843 - command = "%s -dc < %s | %s a -si %s ; chmod 644 %s" % shellEscape((
 855+
 856+ # temp hack force 644 permissions until ubuntu bug # 370618 is fixed - tomasz 5/1/2009
 857+ command = "%s -dc < %s | %s a -si %s ; chmod 644 %s" % shellEscape((
844858 runner.config.bzip2,
845859 xmlbz2,
846860 runner.config.sevenzip,
847861 xml7z,
848 - xml7z));
 862+ xml7z));
 863+
849864 return runner.runCommand(command, callback=self.progressCallback)
850865
851866 def listFiles(self, runner):
@@ -924,10 +939,9 @@
925940
926941 next = config.dbListByAge()
927942 next.reverse()
 943+
 944+ print "Finding oldest unlocked wiki..."
928945
929 - for x in next:
930 - print x
931 -
932946 for db in next:
933947 wiki = WikiDump.Wiki(config, db)
934948 try:

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r50526fixing spacingtomasz18:00, 12 May 2009

Comments

#Comment by Aaron Schulz (talk | contribs)   03:49, 26 May 2009

Looks good and seems to work.

Status & tagging log