| 97 | |
| 98 | # Return possible db files for the site |
| 99 | def getDbFiles(self): |
| 100 | found = 0 |
| 101 | for content_inner_path, content in self.site.content_manager.contents.items(): |
| 102 | # content.json file itself |
| 103 | if self.isFile(content_inner_path): |
| 104 | yield content_inner_path, self.getPath(content_inner_path) |
| 105 | else: |
| 106 | self.log.error("[MISSING] %s" % content_inner_path) |
| 107 | # Data files in content.json |
| 108 | content_inner_path_dir = helper.getDirname(content_inner_path) # Content.json dir relative to site |
| 109 | for file_relative_path in list(content.get("files", {}).keys()) + list(content.get("files_optional", {}).keys()): |
| 110 | if not file_relative_path.endswith(".json") and not file_relative_path.endswith("json.gz"): |
| 111 | continue # We only interesed in json files |
| 112 | file_inner_path = content_inner_path_dir + file_relative_path # File Relative to site dir |
| 113 | file_inner_path = file_inner_path.strip("/") # Strip leading / |
| 114 | if self.isFile(file_inner_path): |
| 115 | yield file_inner_path, self.getPath(file_inner_path) |
| 116 | else: |
| 117 | self.log.error("[MISSING] %s" % file_inner_path) |
| 118 | found += 1 |
| 119 | if found % 100 == 0: |
| 120 | time.sleep(0.001) # Context switch to avoid UI block |
| 121 | |
| 122 | # Rebuild sql cache |
| 123 | @util.Noparallel() |