z_sites_manager (zotonic_core v1.0.0-rc.12)
Link to this section Summary
Functions
Wait for a site to complete its startup sequence.
Convert process state when code is changed
Scan all sites subdirectories for the site configurations.
Called by the zotonic_filehandler after a file has been changed. This relays the file change event to all sites using the #filewatcher{} event.
Do something for all sites that are currently running.
The list of builtin sites, they are located in the zotonic/apps/ directory.
Return the name of the site to handle unknown Host requests
Fetch the configuration of a specific site.
Return a list of contexts for all running sites.
Get the status of a particular site
Return a list of all sites and their current running status. This is coming from the ets table, so might be a bit delayed.
Return a list of all sites, their current running status and their hosts configs
Return all sites
Return information on all running sites.
Initiates the server.
Return true iff all sites are running. Don't count sites manually stopped.
Tell the sites manager that a module was loaded, check changes to observers, schema.
Override a given site config with arbitrary key/value pairs. Should be called before the site is started.
Restart a site or multiple sites.
Set the status of a site, called by the site supervisor
Start a site or multiple sites.
Starts the server
Stop a site or multiple sites.
This function is called by a gen_server when it is about to terminate.
Sync the supervised sites with the sites in the sites directory. Removes and stops deleted sites, adds (but does not start) new sites.
Wait for a site to be running, max 30 secs.
Link to this section Types
Link to this type
site_status/0
-type site_status() :: new | starting | running | stopping | retrying | failed | stopped | removing.
Link to this section Functions
Link to this function
await_startup(Context)
-spec await_startup(z:context() | atom()) -> ok | {error, bad_name | failed | removing | stopped | stopping}.
Link to this function
code_change(OldVsn, State, Extra)
Link to this function
do_scan_sites()
-spec do_scan_sites() -> #{Site :: atom() => proplists:proplist()}.
Link to this function
do_scan_sites(_)
Link to this function
filechanged_observer(Zotonic_filehandler_filechange, CallContext)
-spec filechanged_observer(#zotonic_filehandler_filechange{}, term()) -> ok.
Link to this function
foreach(Fun)
-spec foreach(fun((z:context()) -> any())) -> ok.
Link to this function
get_builtin_sites()
-spec get_builtin_sites() -> [atom()].
Link to this function
get_fallback_site()
-spec get_fallback_site() -> atom() | undefined.
Link to this function
get_site_config(Site)
-spec get_site_config(atom()) -> {ok, list()} | {error, bad_name | term()}.
Link to this function
get_site_config_overrides(Site)
Link to this function
get_site_contexts()
-spec get_site_contexts() -> [z:context()].
Link to this function
get_site_status(Context)
-spec get_site_status(z:context() | atom()) -> {ok, site_status()} | {error, bad_name}.
Link to this function
get_sites()
-spec get_sites() -> #{atom() => site_status()}.
Link to this function
get_sites_hosts()
-spec get_sites_hosts() -> {ok, #{atom() => {site_status(), [{Host :: binary(), Prio :: pos_integer()}]}}}.
Link to this function
handle_call(Message, From, State)
Link to this function
handle_cast(Message, State)
Link to this function
handle_info(Info, State)
Link to this function
info()
-spec info() -> {ok, #{atom() => #site_status{}}}.
Link to this function
init(_)
Link to this function
is_sites_running()
-spec is_sites_running() -> boolean().
Link to this function
module_loaded(Module)
Link to this function
put_site_config_overrides(Site, Overrides)
Link to this function
restart(Site)
Link to this function
set_site_status(Site, Status)
-spec set_site_status(atom(), site_status()) -> ok.
Link to this function
start(Site)
Link to this function
start_link()
Link to this function
stop(Site)
Link to this function
terminate(Reason, State)
Link to this function
upgrade()
-spec upgrade() -> ok.
Link to this function
wait_for_running(Site)
-spec wait_for_running(atom()) -> ok | {error, bad_name | timeout | stopped | removing | term()}.
Link to this function
wait_for_running(Site, Secs)
-spec wait_for_running(atom(), Secs :: integer()) ->
ok | {error, bad_name | timeout | stopped | removing | term()}.