Rev3148, Fix big site size calculation

This commit is contained in:
shortcutme 2017-11-28 18:16:37 +01:00
parent fdd82f7ac4
commit 2b611ae798
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
2 changed files with 5 additions and 1 deletions

View File

@ -10,7 +10,7 @@ class Config(object):
def __init__(self, argv):
self.version = "0.6.0"
self.rev = 3146
self.rev = 3148
self.argv = argv
self.action = None
self.config_file = "zeronet.conf"

View File

@ -732,6 +732,10 @@ class ContentManager(object):
old_content_size = 0
old_content_size_optional = 0
# Reset site site on first content.json
if not old_content and inner_path == "content.json":
self.site.settings["size"] = 0
content_size_optional = sum([file["size"] for file in content.get("files_optional", {}).values() if file["size"] >= 0])
site_size = self.site.settings["size"] - old_content_size + content_size # Site size without old content plus the new
site_size_optional = self.site.settings["size_optional"] - old_content_size_optional + content_size_optional # Site size without old content plus the new