r20780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20779‎ | r20780 | r20781 >
Date:17:58, 28 March 2007
Author:brion
Status:old
Tags:
Comment:
fix the stupid links DOH
Modified paths:
  • /trunk/backup/WikiDump.py (modified) (history)
  • /trunk/backup/worker.py (modified) (history)

Diff [purge]

Index: trunk/backup/WikiDump.py
@@ -205,6 +205,9 @@
206206 def privateDir(self):
207207 return os.path.join(self.config.privateDir, self.dbName)
208208
 209+ def webDir(self):
 210+ return "/".join((self.config.webRoot, self.dbName))
 211+
209212 # Actions!
210213
211214 def lock(self):
Index: trunk/backup/worker.py
@@ -170,6 +170,9 @@
171171 def latestPath(self, filename):
172172 return self.buildPath(self.wiki.publicDir(), "latest", filename)
173173
 174+ def webPath(self, filename):
 175+ return self.buildPath(self.wiki.webDir(), self.date, filename)
 176+
174177 def makeDir(self, dir):
175178 if exists(dir):
176179 self.debug("Checkdir dir %s ..." % dir)
@@ -404,7 +407,7 @@
405408 filepath = self.publicPath(file)
406409 if status == "done" and exists(filepath):
407410 size = prettySize(getsize(filepath))
408 - webpath = file
 411+ webpath = self.webPath(file)
409412 return "<li class='file'><a href=\"%s\">%s</a> %s</li>" % (webpath, file, size)
410413 else:
411414 return "<li class='missing'>%s</li>" % file
@@ -487,9 +490,9 @@
488491
489492 def saveFeed(self, file):
490493 self.makeDir(join(self.wiki.publicDir(), 'latest'))
491 - webPath = "%s/%s/%s/" % (self.config.webRoot, self.dbName, self.date)
492 - fileName = "%s-%s-%s" % (self.dbName, self.date, file)
493 - filePath = webPath + fileName
 494+ filePath = self.webPath(file)
 495+ fileName = os.path.basename(filePath)
 496+ webPath = os.path.dirname(filePath)
494497 rssText = self.config.readTemplate("feed.xml") % {
495498 "chantitle": file,
496499 "chanlink": webPath,