MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / update

Method update

src/Site/Site.py:453–490  ·  view source on GitHub ↗
(self, announce=False, check_files=False, since=None)

Source from the content-addressed store, hash-verified

451 # Return: None
452 @util.Noparallel()
453 def update(self, announce=False, check_files=False, since=None):
454 self.content_manager.loadContent("content.json", load_includes=False) # Reload content.json
455 self.content_updated = None # Reset content updated time
456
457 if check_files:
458 self.storage.updateBadFiles(quick_check=True) # Quick check and mark bad files based on file size
459
460 if not self.isServing():
461 return False
462
463 self.updateWebsocket(updating=True)
464
465 # Remove files that no longer in content.json
466 self.checkBadFiles()
467
468 if announce:
469 self.announce(force=True)
470
471 # Full update, we can reset bad files
472 if check_files and since == 0:
473 self.bad_files = {}
474
475 queried = self.checkModifications(since)
476
477 changed, deleted = self.content_manager.loadContent("content.json", load_includes=False)
478
479 if self.bad_files:
480 self.log.debug("Bad files: %s" % self.bad_files)
481 gevent.spawn(self.retryBadFiles, force=True)
482
483 if len(queried) == 0:
484 # Failed to query modifications
485 self.content_updated = False
486 self.bad_files["content.json"] = 1
487 else:
488 self.content_updated = time.time()
489
490 self.updateWebsocket(updated=True)
491
492 # Update site by redownload all content.json
493 def redownloadContents(self):

Callers 15

mainFunction · 0.45
startFunction · 0.45
eventMethod · 0.45
updateThreadMethod · 0.45
__init__Method · 0.45
sendHeaderMethod · 0.45
updateJsonMethod · 0.45
insertOrUpdateMethod · 0.45
portCheckMethod · 0.45
checkSiteMethod · 0.45
cleanupSitesMethod · 0.45
mergeDictsFunction · 0.45

Calls 7

isServingMethod · 0.95
updateWebsocketMethod · 0.95
checkBadFilesMethod · 0.95
announceMethod · 0.95
checkModificationsMethod · 0.95
loadContentMethod · 0.80
updateBadFilesMethod · 0.80

Tested by

no test coverage detected