Index: trunk/backup/worker.py |
— | — | @@ -246,9 +246,7 @@ |
247 | 247 | XmlDump("meta-current", |
248 | 248 | "All pages, current versions only.", |
249 | 249 | "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")] |
253 | 251 | |
254 | 252 | if not self.wiki.isBig(): |
255 | 253 | self.items.append( |
— | — | @@ -341,13 +339,13 @@ |
342 | 340 | |
343 | 341 | def saveStatus(self, items, done=False): |
344 | 342 | """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" |
352 | 350 | |
353 | 351 | def progressReports(self): |
354 | 352 | status = {} |
— | — | @@ -442,13 +440,14 @@ |
443 | 441 | html += "</li>" |
444 | 442 | return html |
445 | 443 | |
| 444 | + # Report on the file size & status of the current output and output a link if were done |
446 | 445 | def reportFile(self, file, status): |
447 | 446 | 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): |
452 | 448 | 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)) |
453 | 452 | webpath = self.webPath(file) |
454 | 453 | return "<li class='file'><a href=\"%s\">%s</a> %s</li>" % (webpath, file, size) |
455 | 454 | else: |
— | — | @@ -644,15 +643,13 @@ |
645 | 644 | def listFiles(self, runner): |
646 | 645 | return ["stub-meta-history.xml.gz", |
647 | 646 | "stub-meta-current.xml.gz", |
648 | | - "stub-articles.xml.gz", |
649 | | - "logging.xml.gz"] |
| 647 | + "stub-articles.xml.gz",] |
650 | 648 | |
651 | 649 | def run(self, runner): |
652 | 650 | history = runner.publicPath("stub-meta-history.xml.gz") |
653 | 651 | current = runner.publicPath("stub-meta-current.xml.gz") |
654 | 652 | 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): |
657 | 654 | if exists(filename): |
658 | 655 | os.remove(filename) |
659 | 656 | command = """ |
— | — | @@ -679,7 +676,24 @@ |
680 | 677 | history, |
681 | 678 | current, |
682 | 679 | 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) |
684 | 698 | command = """ |
685 | 699 | %s -q %s/maintenance/dumpBackup.php \ |
686 | 700 | --wiki=%s \ |
— | — | @@ -837,14 +851,15 @@ |
838 | 852 | # Clear prior 7zip attempts; 7zip will try to append an existing archive |
839 | 853 | if exists(xml7z): |
840 | 854 | 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(( |
844 | 858 | runner.config.bzip2, |
845 | 859 | xmlbz2, |
846 | 860 | runner.config.sevenzip, |
847 | 861 | xml7z, |
848 | | - xml7z)); |
| 862 | + xml7z)); |
| 863 | + |
849 | 864 | return runner.runCommand(command, callback=self.progressCallback) |
850 | 865 | |
851 | 866 | def listFiles(self, runner): |
— | — | @@ -924,10 +939,9 @@ |
925 | 940 | |
926 | 941 | next = config.dbListByAge() |
927 | 942 | next.reverse() |
| 943 | + |
| 944 | + print "Finding oldest unlocked wiki..." |
928 | 945 | |
929 | | - for x in next: |
930 | | - print x |
931 | | - |
932 | 946 | for db in next: |
933 | 947 | wiki = WikiDump.Wiki(config, db) |
934 | 948 | try: |