siteListModifiedFiles admin command

This commit is contained in:
shortcutme 2019-02-02 00:11:47 +01:00
parent af0b563036
commit 259c5199d6
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 72 additions and 2 deletions

View file

@ -349,6 +349,26 @@ class ContentManager(object):
hash_id = self.hashfield.getHashId(file_info["sha512"])
return hash_id in self.hashfield
# Is modified since signing
def isModified(self, inner_path):
s = time.time()
if inner_path.endswith("content.json"):
try:
is_valid = self.verifyFile(inner_path, self.site.storage.open(inner_path), ignore_same=False)
if is_valid:
is_modified = False
else:
is_modified = True
except VerifyError:
is_modified = True
else:
try:
self.verifyFile(inner_path, self.site.storage.open(inner_path), ignore_same=False)
is_modified = False
except VerifyError:
is_modified = True
return is_modified
# Find the file info line from self.contents
# Return: { "sha512": "c29d73d...21f518", "size": 41 , "content_inner_path": "content.json"}
def getFileInfo(self, inner_path, new_file=False):