Index: trunk/backup/WikiBackup.py |
— | — | @@ -76,6 +76,10 @@ |
77 | 77 | def prettyTime(): |
78 | 78 | return time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()) |
79 | 79 | |
| 80 | +def prettyDate(key): |
| 81 | + "Prettify a MediaWiki date key" |
| 82 | + return "-".join((key[0:4], key[4:6], key[6:8])) |
| 83 | + |
80 | 84 | def dumpFile(filename, text): |
81 | 85 | """Dump a string to a file.""" |
82 | 86 | file = open(filename, "wt") |
— | — | @@ -406,6 +410,7 @@ |
407 | 411 | return html |
408 | 412 | |
409 | 413 | def reportStatus(self, items, done=False): |
| 414 | + """Put together a status page for this database, with all its component dumps.""" |
410 | 415 | statusItems = [self.reportItem(item) for item in items] |
411 | 416 | statusItems.reverse() |
412 | 417 | html = "\n".join(statusItems) |
— | — | @@ -413,8 +418,18 @@ |
414 | 419 | "db": self.db, |
415 | 420 | "date": self.date, |
416 | 421 | "status": self.reportStatusLine(done), |
| 422 | + "previous": self.reportPreviousDump(), |
417 | 423 | "items": html} |
418 | 424 | |
| 425 | + def reportPreviousDump(self): |
| 426 | + """Produce a link to the previous dump, if any""" |
| 427 | + try: |
| 428 | + raw = self.latestDump(self.db, -2) |
| 429 | + except: |
| 430 | + return "No prior dumps of this database stored."; |
| 431 | + date = prettyDate(raw) |
| 432 | + return "<a href=\"../%s/\">Last dumped on %s</a>" % (raw, date) |
| 433 | + |
419 | 434 | def reportStatusLine(self, done=False): |
420 | 435 | if done: |
421 | 436 | classes = "done" |
Index: trunk/backup/report.html |
— | — | @@ -62,6 +62,10 @@ |
63 | 63 | |
64 | 64 | <p>See <a href="../../">all databases list</a>.</p> |
65 | 65 | |
| 66 | + <div class="previous"> |
| 67 | + %(previous)s |
| 68 | + </div> |
| 69 | + |
66 | 70 | <div class="status"> |
67 | 71 | %(status)s |
68 | 72 | </div> |