mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-10 03:37:39 +02:00
Automagic: Update clear-cache and do removals first
This commit is contained in:
@@ -224,8 +224,4 @@ def list_plugins() -> Dict[str, Type[interfaces.plugins.PluginInterface]]:
|
||||
|
||||
|
||||
def clear_cache(complete=False):
|
||||
glob_pattern = "*.cache"
|
||||
if not complete:
|
||||
glob_pattern = "data_" + glob_pattern
|
||||
for cache_filename in glob.glob(os.path.join(constants.CACHE_PATH, glob_pattern)):
|
||||
os.unlink(cache_filename)
|
||||
os.unlink(os.path.join(constants.CACHE_PATH, constants.IDENTIFIERS_FILENAME))
|
||||
|
||||
@@ -310,6 +310,14 @@ class SqliteCache(CacheManagerInterface):
|
||||
new_locations = on_disk_locations.difference(cached_locations)
|
||||
missing_locations = cached_locations.difference(on_disk_locations)
|
||||
|
||||
# Missing entries
|
||||
if missing_locations:
|
||||
self._database.cursor().execute(
|
||||
f"DELETE FROM cache WHERE location IN ({','.join(['?'] * len(missing_locations))})",
|
||||
[x for x in missing_locations],
|
||||
)
|
||||
self._database.commit()
|
||||
|
||||
cache_update = set()
|
||||
files_to_timestamp = on_disk_locations.intersection(cached_locations)
|
||||
if files_to_timestamp:
|
||||
@@ -437,15 +445,6 @@ class SqliteCache(CacheManagerInterface):
|
||||
progress_callback(100, "Reading remote ISF list")
|
||||
self._database.commit()
|
||||
|
||||
# Missing entries
|
||||
|
||||
if missing_locations:
|
||||
self._database.cursor().execute(
|
||||
f"DELETE FROM cache WHERE location IN ({','.join(['?'] * len(missing_locations))})",
|
||||
[x for x in missing_locations],
|
||||
)
|
||||
self._database.commit()
|
||||
|
||||
def get_identifier_dictionary(
|
||||
self, operating_system: Optional[str] = None, local_only: bool = False
|
||||
) -> Dict[bytes, str]:
|
||||
|
||||
Reference in New Issue
Block a user