Copyright © 2009-2020 Marc Worrell
Behaviours: gen_server.
Authors: Marc Worrell (marc@worrell.nl).
site_status() = new | starting | running | stopping | retrying | failed | stopped | removing
await_startup/1 | Wait for a site to complete its startup sequence. |
code_change/3 | Convert process state when code is changed. |
do_scan_sites/0 | Scan all sites subdirectories for the site configurations. |
do_scan_sites/1 | |
filechanged_observer/1 | Called by the zotonic_filehandler after a file has been changed. |
foreach/1 | Do something for all sites that are currently running. |
get_builtin_sites/0 | The list of builtin sites, they are located in the zotonic/apps/ directory. |
get_fallback_site/0 | Return the name of the site to handle unknown Host requests. |
get_site_config/1 | Fetch the configuration of a specific site. |
get_site_config_overrides/1 | |
get_site_contexts/0 | Return a list of contexts for all running sites. |
get_site_status/1 | Get the status of a particular site. |
get_sites/0 | Return a list of all sites and their current running status. |
get_sites_hosts/0 | Return a list of all sites, their current running status and their hosts configs. |
handle_call/3 | Return all sites. |
handle_cast/2 | |
handle_info/2 | |
info/0 | Return information on all running sites. |
init/1 | Initiates the server. |
is_sites_running/0 | Return true iff all sites are running. |
module_loaded/1 | Tell the sites manager that a module was loaded, check changes to observers, schema. |
put_site_config_overrides/2 | Override a given site config with arbitrary key/value pairs. |
restart/1 | Restart a site or multiple sites. |
set_site_status/2 | Set the status of a site, called by the site supervisor. |
start/1 | Start a site or multiple sites. |
start_link/0 | Starts the server. |
stop/1 | Stop a site or multiple sites. |
terminate/2 | This function is called by a gen_server when it is about to terminate. |
upgrade/0 | Sync the supervised sites with the sites in the sites directory. |
wait_for_running/1 | Wait for a site to be running, max 30 secs. |
wait_for_running/2 |
await_startup(Context::z:context() | atom()) -> ok | {error, bad_name | failed | removing | stopped | stopping}
Wait for a site to complete its startup sequence.
code_change(OldVsn, State, Extra) -> {ok, NewState}
Convert process state when code is changed
do_scan_sites() -> #{Site::atom() => proplists:proplist()}
Scan all sites subdirectories for the site configurations.
do_scan_sites(X1) -> any()
filechanged_observer(Zotonic_filehandler_filechange::#zotonic_filehandler_filechange{}) -> ok
Called by the zotonic_filehandler after a file has been changed. This relays the file change event to all sites using the #filewatcher{} event.
foreach(Fun::fun((z:context()) -> any())) -> ok
Do something for all sites that are currently running.
get_builtin_sites() -> [atom()]
The list of builtin sites, they are located in the zotonic/apps/ directory.
get_fallback_site() -> atom() | undefined
Return the name of the site to handle unknown Host requests
get_site_config(Site::atom()) -> {ok, list()} | {error, bad_name | term()}
Fetch the configuration of a specific site.
get_site_config_overrides(Site) -> any()
get_site_contexts() -> [z:context()]
Return a list of contexts for all running sites.
get_site_status(Context::z:context() | atom()) -> {ok, site_status()} | {error, bad_name}
Get the status of a particular site
get_sites() -> #{atom() => site_status()}
Return a list of all sites and their current running status. This is coming from the ets table, so might be a bit delayed.
get_sites_hosts() -> {ok, #{atom() => {site_status(), [{Host::binary(), Prio::pos_integer()}]}}}
Return a list of all sites, their current running status and their hosts configs
handle_call(Message::Request, From, State) -> {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}
Return all sites
handle_cast(Message::Msg, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}
handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}
info() -> {ok, #{atom() => #site_status{site = atom(), is_enabled = any(), status = site_status(), pid = undefined | pid(), mref = undefined | reference(), start_time = undefined | erlang:timestam(), stop_time = undefined | erlang:timestamp(), stop_count = integer(), crash_time = undefined | erlang:timestamp(), crash_count = integer(), config = list()}}}
Return information on all running sites.
init(X1::Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}
Initiates the server.
is_sites_running() -> boolean()
Return true iff all sites are running. Don't count sites manually stopped.
module_loaded(Module) -> any()
Tell the sites manager that a module was loaded, check changes to observers, schema.
put_site_config_overrides(Site, Overrides) -> any()
Override a given site config with arbitrary key/value pairs. Should be called before the site is started.
restart(Site) -> any()
Restart a site or multiple sites.
set_site_status(Site::atom(), Status::site_status()) -> ok
Set the status of a site, called by the site supervisor
start(Site) -> any()
Start a site or multiple sites.
start_link() -> {ok, Pid} | ignore | {error, Error}
Starts the server
stop(Site) -> any()
Stop a site or multiple sites.
terminate(Reason, State) -> void()
This function is called by a gen_server when it is about to terminate.
upgrade() -> ok
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_running(Site::atom()) -> ok | {error, bad_name | timeout | stopped | removing | term()}
Wait for a site to be running, max 30 secs.
wait_for_running(Site::atom(), Secs::integer()) -> ok | {error, bad_name | timeout | stopped | removing | term()}
Generated by EDoc