Change getTotalSize to use content.db cache

This commit is contained in:
shortcutme 2016-09-04 17:44:30 +02:00
parent 23e06a09cb
commit 1801df32a6

View file

@ -241,14 +241,12 @@ class ContentManager(object):
# Get total size of site # Get total size of site
# Return: 32819 (size of files in kb) # Return: 32819 (size of files in kb)
def getTotalSize(self, ignore=None): def getTotalSize(self, ignore=None):
total_size = 0 size = self.contents.db.getTotalSize(self.site.address, ignore)
for inner_path, content in self.contents.iteritems(): if size:
if inner_path == ignore: return size
continue else:
total_size += self.site.storage.getSize(inner_path) # Size of content.json return 0
for file, info in content.get("files", {}).iteritems():
total_size += info["size"]
return total_size
# Returns if file with the given modification date is archived or not # Returns if file with the given modification date is archived or not
def isArchived(self, inner_path, modified): def isArchived(self, inner_path, modified):