z_module_manager (zotonic_core v1.0.0-rc.11)
Link to this section Summary
Functions
Activate a module. The module is marked as active and started as a child of the module supervisor. The module manager can be checked later to see if the module started or not.
Before activating a module, check if it depends on non-activated other modules. This checks the complete graph of all modules that are currently activated plus the new modules. All missing dependencies will be listed. This also shows the modules that have missing dependencies and can't run because of those missing dependencies.
Return the list of active modules.
Return whether a specific module is active.
Return the list of all active modules and their directories
Return the list of all modules in the database.
Convert process state when code is changed
Deactivate a module. The module is marked as deactivated and stopped when it was running.
Before deactivating a module, check if active modules depend on the deactivated module. This checks the complete graph of all modules that are currently activated minus the deactivated module. All missing dependencies will be listed. This also shows the modules that have missing dependencies and can't run because of those missing dependencies.
Return a module's dependencies as a tuple usable for z_toposort:sort/1.
Sort all modules on their dependencies (with sub sort the module's priority)
Return the list of all modules running.
Return the status of all running modules.
Return the list of all provided functionalities in running modules.
Return the status of any ongoing upgrade
Return a list of all modules
Sync enabled modules with loaded modules
Initiates the server.
Check if a service is provided by any module.
Check if the code of a module exists. The database can hold module references to non-existing modules.
Check all observers of a module, ensure that they are all active. Used after a module has been reloaded
Return the priority of a module. Default priority is 500, lower is higher priority. Never crash on a missing module.
Sort the results of a scan on module priority first, module name next. The list is made up of {module, Values} tuples
Reinstall the given module's schema, calling Module:manage_schema(install, Context); if that function exists.
Restart a module, activates the module if it was not activated.
Scan for a list of modules. A module is always an OTP application, the name of the application is similar to the name of the module.
Scan for a list of modules and the current site. A module is always an OTP application,
Return a table with per dependeny which modules depend on it.
Return a table with per provision which modules provide it.
Starts the module manager
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.
Get the title of a module.
Reload the list of all modules, add processes if necessary.
Wait till all modules are started, used when starting up a new or test site.
Return the pid of a running module
Link to this section Types
Link to this type
manage_schema/0
-type manage_schema() :: install | {upgrade, integer()}.
Link to this type
module_status/0
-type module_status() ::
new | starting | running | stopping | restarting | retrying | failed | stopped | removing.
Link to this section Functions
Link to this function
activate(Module, Context)
-spec activate(atom(), z:context()) -> ok | {error, not_found}.
Link to this function
activate_await(Module, Context)
-spec activate_await(atom(), z:context()) -> ok | {error, not_active | not_found}.
Link to this function
activate_precheck(Module, Context)
-spec activate_precheck(atom() | [atom()], z:context()) -> ok | {error, #{atom() => [atom()]}} | {error, {cyclic, z_toposort:cycles()}}.
Link to this function
active(Context)
-spec active(#context{}) -> [Module :: atom()].
Link to this function
active(Module, Context)
-spec active(Module :: atom(), #context{}) -> boolean().
Link to this function
active_dir(Context)
-spec active_dir(z:context()) -> [{Module :: atom(), Dir :: file:filename_all()}].
Link to this function
all(Context)
-spec all(z:context()) -> [atom()].
Link to this function
code_change(OldVsn, State, Extra)
Link to this function
deactivate(Module, Context)
-spec deactivate(atom(), z:context()) -> ok.
Link to this function
deactivate_precheck(Module, Context)
-spec deactivate_precheck(atom(), z:context()) -> ok | {error, #{atom() => [atom()]}} | {error, {cyclic, z_toposort:cycles()}}.
Link to this function
dependencies(M)
-spec dependencies({atom(), term()} | atom()) ->
{atom() | {atom(), term()}, Depends :: [atom()], Provides :: [atom()]}.
Link to this function
dependency_sort(Context)
-spec dependency_sort(z:context() | [atom()]) -> {ok, [atom()]} | {error, {cyclic, z_toposort:cycles()}}.
Link to this function
get_modules(Context)
Link to this function
get_modules_status(Context)
Link to this function
get_provided(Context)
-spec get_provided(z:context()) -> [atom()].
Link to this function
get_upgrade_status(Context)
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
init(Site)
Link to this function
is_provided(Service, Context)
-spec is_provided(atom(), z:context()) -> boolean().
Link to this function
lib_dir(Module)
-spec lib_dir(atom()) -> {error, bad_name} | file:filename().
Link to this function
module_exists(M)
Link to this function
module_reloaded(Module, Context)
-spec module_reloaded(Module :: atom(), #context{}) -> ok.
Link to this function
module_to_app(Module)
-spec module_to_app(atom()) -> atom().
Link to this function
prio(Module)
-spec prio(atom()) -> integer().
Link to this function
prio_sort(ModuleProps)
-spec prio_sort([atom() | {atom(), term()}]) -> [atom() | {atom(), term()}].
Link to this function
reinstall(Module, Context)
Link to this function
restart(Module, Context)
-spec restart(Module :: atom(), #context{}) -> ok | {error, not_found}.
Link to this function
scan()
-spec scan() -> [{Module :: atom(), Application :: atom(), Dir :: file:filename_all()}].
Link to this function
scan(Context)
-spec scan(z:context()) -> [{Module :: atom(), Application :: atom(), Dir :: file:filename_all()}].
Link to this function
scan_depending(Context)
-spec scan_depending(z:context()) -> #{atom() := [atom()]}.
Link to this function
scan_provided(Context)
-spec scan_provided(z:context()) -> #{atom() := [atom()]}.
Link to this function
start_link(Site)
Link to this function
startable(M, Context)
Link to this function
terminate(Reason, State)
Link to this function
title(M)
Link to this function
upgrade(Context)
-spec upgrade(z:context()) -> ok.
Link to this function
upgrade_await(Context)
-spec upgrade_await(z:context()) -> ok | {error, timeout}.
Link to this function
whereis(Module, Context)
-spec whereis(atom(), z:context()) -> {ok, pid()} | {error, not_running | not_found}.