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
code_change/3Convert process state when code is changed.
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_contexts/0Return a list of contexts initialized for all active sites.
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.
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()

code_change/3

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

Convert process state when code is changed

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_contexts/0

get_site_contexts() -> [#context{}]

Return a list of contexts initialized for all active sites.

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.

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, Oct 22 2014, 21:45:08.