MishkaCmsCore.Runtime.Handlers.SiteRuntime (Mishka CMS Core v0.0.1)

Copy Markdown View Source

Shared per-site purge of runtime artifacts — compiled modules, cached CSS/JS, routing entries, and on-disk templates. Used by both the permanent-delete teardown (MishkaCmsCore.Runtime.Workers.SiteTeardownWorker) and the activate/deactivate/rename worker (MishkaCmsCore.Runtime.Workers.SiteRuntimeWorker).

Recompilation (the other direction) is BootHandler.compile_site/2.

Summary

Functions

Streams the site's module-backed records and returns [%{"type", "key"}] — the inputs to Helpers.module_name/3. Call while the rows still exist (for the permanent-delete teardown, capture before the cascade).

Frees a site's runtime artifacts from RAM, all keyed by site_name: unloads the given module specs, drops the cached CSS/JS (AssetsState), and clears routing (WebRunTimeMetaDataState). When remove_templates? is true (rename / permanent-delete) the site's on-disk template dir is removed too. Returns the counts; :modules is how many were actually loaded (and thus genuinely freed).

Unloads the given module specs of the site site_name, and nothing else — its cached CSS/JS, routing and templates stay. Returns how many were loaded. A module is compiled for its site's name and host, so a new host needs new ones: BootHandler.compile_site/2 builds them again, and a lazy one is built by the first request for it.

Functions

module_specs(site_id)

Streams the site's module-backed records and returns [%{"type", "key"}] — the inputs to Helpers.module_name/3. Call while the rows still exist (for the permanent-delete teardown, capture before the cascade).

purge_parts(site_name, module_specs, remove_templates?)

Frees a site's runtime artifacts from RAM, all keyed by site_name: unloads the given module specs, drops the cached CSS/JS (AssetsState), and clears routing (WebRunTimeMetaDataState). When remove_templates? is true (rename / permanent-delete) the site's on-disk template dir is removed too. Returns the counts; :modules is how many were actually loaded (and thus genuinely freed).

unload_modules(site_name, module_specs)

Unloads the given module specs of the site site_name, and nothing else — its cached CSS/JS, routing and templates stay. Returns how many were loaded. A module is compiled for its site's name and host, so a new host needs new ones: BootHandler.compile_site/2 builds them again, and a lazy one is built by the first request for it.