Plugin static files fix (#7532)

* Improve logging messages

* Refactor

* Re-add import

- Weird?
This commit is contained in:
Oliver 2024-06-29 20:11:28 +10:00 committed by GitHub
parent f67147587a
commit b924530627
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,19 +38,20 @@ def collect_plugins_static_files():
logger.info('Collecting static files for all installed plugins.')
for slug in registry.plugins.keys():
copy_plugin_static_files(slug)
copy_plugin_static_files(slug, check_reload=False)
def copy_plugin_static_files(slug):
def copy_plugin_static_files(slug, check_reload=True):
"""Copy static files for the specified plugin."""
registry.check_reload()
if check_reload:
registry.check_reload()
plugin = registry.get_plugin(slug)
if not plugin:
return
logger.info("Copying static files for plugin '%s'")
logger.info("Copying static files for plugin '%s'", slug)
# Get the source path for the plugin
source_path = plugin.path().joinpath('static')
@ -86,7 +87,7 @@ def copy_plugin_static_files(slug):
with item.open('rb') as src:
staticfiles_storage.save(destination_path, src)
logger.debug(f'- copied {item} to {destination_path}')
logger.debug('- copied %s to %s', str(item), str(destination_path))
copied += 1
logger.info(f"Copied %s static files for plugin '%s'.", copied, slug)