r99435 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99434‎ | r99435 | r99436 >
Date:21:47, 10 October 2011
Author:ariel
Status:deferred
Tags:
Comment:
function for file size and date
Modified paths:
  • /branches/ariel/xmldumps-backup/WikiDump.py (modified) (history)

Diff [purge]

Index: branches/ariel/xmldumps-backup/WikiDump.py
@@ -87,6 +87,17 @@
8888 else:
8989 return FileUtils._prettySize(size / 1024.0, quanta[1:])
9090
 91+ def fileInfo(path):
 92+ """Return a tuple of date/time and size of a file, or None, None"""
 93+ try:
 94+ timestamp = time.gmtime(os.stat(path).st_mtime)
 95+ timestamp = time.strftime("%Y-%m-%d %H:%M:%S",timestamp)
 96+ size = os.path.getsize(path)
 97+ return (timestamp, size)
 98+ except:
 99+ raise
 100+ return(None, None)
 101+
91102 fileAge = staticmethod(fileAge)
92103 atomicCreate = staticmethod(atomicCreate)
93104 writeFile = staticmethod(writeFile)
@@ -96,6 +107,7 @@
97108 relativePath = staticmethod(relativePath)
98109 prettySize = staticmethod(prettySize)
99110 _prettySize = staticmethod(_prettySize)
 111+ fileInfo = staticmethod(fileInfo)
100112
101113 class TimeUtils(object):
102114

Sign-offs

UserFlagDate
Nikerabbitinspected15:09, 11 October 2011

Status & tagging log