Module z_sites_manager

Server managing all sites running inside Zotonic.

Copyright 2009-2010 Marc Worrell

Behaviours: gen_server.

Authors: Marc Worrell (marc@worrell.nl).

Description

Server managing all sites running inside Zotonic. Starts the sites according to the config files in the sites subdirectories.

Function Index

all_sites_running/0Return true iff all sites are running.
all_sites_running/1
await_startup/1Wait for a site to complete its startup sequence.
code_change/3Convert process state when code is changed.
foreach/1Do something for all sites that are currently running.
get_builtin_sites/0The list of builtin sites, they are located in the priv/sites directory.
get_fallback_site/0Return the name of the site to handle unknown Host requests.
get_site_config/1Fetch the configuration of a specific site.
get_site_config_overrides/1
get_site_contexts/0Return a list of contexts initialized for all active sites.
get_site_status/1Get the status of a particular site.
get_sites/0Return a list of active site names.
get_sites_all/0Return a list of all site names.
get_sites_status/0Return a list of all sites and their status.
handle_call/3Return the active sites.
handle_cast/2Sync known sites with loaded sites.
handle_info/2Handling all non call/cast messages.
info/0Return information on all running sites.
init/1Initiates the server.
module_loaded/1Tell the sites manager that a module was loaded, check changes to observers, schema.
put_site_config_overrides/2Override a given site config with arbitrary key/value pairs.
restart/1Restart a site or multiple sites.
start/1Start a site or multiple sites.
start_link/0Starts the server.
stop/1Stop a site or multiple sites.
terminate/2This function is called by a gen_server when it is about to terminate.
upgrade/0Sync the supervised sites with the sites in the sites directory.

Function Details

all_sites_running/0

all_sites_running() -> boolean()

Return true iff all sites are running.

all_sites_running/1

all_sites_running(StateInfo::[{atom(), integer()}]) -> boolean()

await_startup/1

await_startup(Context) -> any()

Wait for a site to complete its startup sequence. Note - due to the way the site startup works currently, we cannot know whether the site has already started or not. Therefore, this function should only be called when you are certain the site has not completed starting up, otherwise it will block infinitely.

code_change/3

code_change(OldVsn, State, Extra) -> {ok, NewState}

Convert process state when code is changed

foreach/1

foreach(Fun) -> any()

Do something for all sites that are currently running.

get_builtin_sites/0

get_builtin_sites() -> [atom()]

The list of builtin sites, they are located in the priv/sites directory.

get_fallback_site/0

get_fallback_site() -> atom() | undefined

Return the name of the site to handle unknown Host requests

get_site_config/1

get_site_config(Site::atom()) -> {ok, list()} | {error, term()}

Fetch the configuration of a specific site.

get_site_config_overrides/1

get_site_config_overrides(Site) -> any()

get_site_contexts/0

get_site_contexts() -> [#context{}]

Return a list of contexts initialized for all active sites.

get_site_status/1

get_site_status(Site) -> any()

Get the status of a particular site

get_sites/0

get_sites() -> [atom()]

Return a list of active site names.

get_sites_all/0

get_sites_all() -> [atom()]

Return a list of all site names.

get_sites_status/0

get_sites_status() -> list()

Return a list of all sites and their status.

handle_call/3

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 the active sites

handle_cast/2

handle_cast(Message::Msg, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Sync known sites with loaded sites

handle_info/2

handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Handling all non call/cast messages

info/0

info() -> [{atom(), integer()}]

Return information on all running sites.

init/1

init(X1::Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}

Initiates the server.

module_loaded/1

module_loaded(Module) -> any()

Tell the sites manager that a module was loaded, check changes to observers, schema.

put_site_config_overrides/2

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/1

restart(Site) -> any()

Restart a site or multiple sites.

start/1

start(Site) -> any()

Start a site or multiple sites.

start_link/0

start_link() -> {ok, Pid} | ignore | {error, Error}

Starts the server

stop/1

stop(Site) -> any()

Stop a site or multiple sites.

terminate/2

terminate(Reason, State) -> void()

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.

upgrade/0

upgrade() -> any()

Sync the supervised sites with the sites in the sites directory. Removes and stops deleted sites, adds (but does not start) new sites.


Generated by EDoc, Jul 27 2016, 14:36:35.