Index: branches/ariel/xmldumps-backup/worker.py |
— | — | @@ -520,7 +520,7 @@ |
521 | 521 | def writeDumpRunInfoFile(self, text): |
522 | 522 | directory = self._getDumpRunInfoDirName() |
523 | 523 | dumpRunInfoFilename = self._getDumpRunInfoFileName() |
524 | | - FileUtils.writeFile(directory, dumpRunInfoFilename, text) |
| 524 | + FileUtils.writeFile(directory, dumpRunInfoFilename, text, self.wiki.config.fileperms) |
525 | 525 | |
526 | 526 | def saveDumpRunInfoFile(self, done=False): |
527 | 527 | """Write out a simple text file with the status for this wiki's dump.""" |
— | — | @@ -857,7 +857,7 @@ |
858 | 858 | # addnotice, stuff notice in a file for other jobs etc |
859 | 859 | elif self.notice != "": |
860 | 860 | noticeDir = self.getNoticeDir() |
861 | | - FileUtils.writeFile(noticeDir, noticeFile, self.notice) |
| 861 | + FileUtils.writeFile(noticeDir, noticeFile, self.notice, self.wiki.config.fileperms) |
862 | 862 | # default case. if there is a file get the contents, otherwise |
863 | 863 | # we have empty contents, all good |
864 | 864 | else: |
— | — | @@ -1265,7 +1265,7 @@ |
1266 | 1266 | "date": time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime())} |
1267 | 1267 | directory = self.dumpDir.latestDir() |
1268 | 1268 | rssPath = self.dumpDir.latestPath(file + "-rss.xml") |
1269 | | - FileUtils.writeFile(directory, rssPath, rssText) |
| 1269 | + FileUtils.writeFile(directory, rssPath, rssText, self.config.fileperms) |
1270 | 1270 | |
1271 | 1271 | class Dump(object): |
1272 | 1272 | def __init__(self, name, desc): |
Index: branches/ariel/xmldumps-backup/WikiDump.py |
— | — | @@ -19,12 +19,14 @@ |
20 | 20 | fd = os.open(filename, os.O_EXCL + os.O_CREAT + os.O_WRONLY) |
21 | 21 | return os.fdopen(fd, mode) |
22 | 22 | |
23 | | - def writeFile(dirname, filename, text): |
| 23 | + def writeFile(dirname, filename, text, perms = 0): |
24 | 24 | """Write text to a file, as atomically as possible, via a temporary file in the same directory.""" |
25 | 25 | |
26 | 26 | (fd, tempFilename ) = tempfile.mkstemp("_txt","wikidump_",dirname); |
27 | 27 | os.write(fd,text) |
28 | 28 | os.close(fd) |
| 29 | + if (perms): |
| 30 | + os.chmod(tempFilename,perms) |
29 | 31 | # This may fail across filesystems or on Windows. |
30 | 32 | # Of course nothing else will work on Windows. ;) |
31 | 33 | os.rename(tempFilename, filename) |
— | — | @@ -150,6 +152,7 @@ |
151 | 153 | "templatedir": home, |
152 | 154 | "perdumpindex": "index.html", |
153 | 155 | "logfile": "dumplog.txt", |
| 156 | + "fileperms": "0640", |
154 | 157 | #"reporting": { |
155 | 158 | "adminmail": "root@localhost", |
156 | 159 | "mailfrom": "root@localhost", |
— | — | @@ -220,7 +223,8 @@ |
221 | 224 | self.templateDir = conf.get("output", "templateDir") |
222 | 225 | self.perDumpIndex = conf.get("output", "perdumpindex") |
223 | 226 | self.logFile = conf.get("output", "logfile") |
224 | | - |
| 227 | + self.fileperms = conf.get("output", "fileperms") |
| 228 | + self.fileperms = int(self.fileperms,0) |
225 | 229 | if not conf.has_section('reporting'): |
226 | 230 | conf.add_section('reporting') |
227 | 231 | self.adminMail = conf.get("reporting", "adminmail") |
— | — | @@ -403,7 +407,7 @@ |
404 | 408 | def writePerDumpIndex(self, html): |
405 | 409 | directory = os.path.join(self.publicDir(), self.date) |
406 | 410 | index = os.path.join(self.publicDir(), self.date, self.config.perDumpIndex) |
407 | | - FileUtils.writeFile(directory, index, html) |
| 411 | + FileUtils.writeFile(directory, index, html, self.config.fileperms) |
408 | 412 | |
409 | 413 | def existsPerDumpIndex(self): |
410 | 414 | index = os.path.join(self.publicDir(), self.date, self.config.perDumpIndex) |
— | — | @@ -412,7 +416,7 @@ |
413 | 417 | def writeStatus(self, message): |
414 | 418 | directory = os.path.join(self.publicDir(), self.date) |
415 | 419 | index = os.path.join(self.publicDir(), self.date, "status.html") |
416 | | - FileUtils.writeFile(directory, index, message) |
| 420 | + FileUtils.writeFile(directory, index, message, self.config.fileperms) |
417 | 421 | |
418 | 422 | def statusLine(self): |
419 | 423 | date = self.latestDump() |