/doc/core/z_sites_manager.html

https://code.google.com/p/zotonic/ · HTML · 143 lines · 120 code · 23 blank · 0 comment · 0 complexity · 6724a52f5fde48fed80f6ebd457ade92 MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Module z_sites_manager</title>
  5. <link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
  6. </head>
  7. <body bgcolor="white">
  8. <div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
  9. <hr>
  10. <h1>Module z_sites_manager</h1>
  11. <ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Server managing all sites running inside Zotonic.
  12. <p>Copyright Š 2009-2010 Marc Worrell</p>
  13. <p><b>Behaviours:</b> <a href="gen_server.html"><tt>gen_server</tt></a>.</p>
  14. <p><b>Authors:</b> Marc Worrell (<a href="mailto:marc@worrell.nl"><tt>marc@worrell.nl</tt></a>).</p>
  15. <h2><a name="description">Description</a></h2>Server managing all sites running inside Zotonic. Starts the sites
  16. according to the config files in the sites subdirectories.
  17. <h2><a name="index">Function Index</a></h2>
  18. <table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#code_change-3">code_change/3</a></td><td>Convert process state when code is changed.</td></tr>
  19. <tr><td valign="top"><a href="#get_fallback_site-0">get_fallback_site/0</a></td><td>Return the name of the site to handle unknown Host requests.</td></tr>
  20. <tr><td valign="top"><a href="#get_site_config-1">get_site_config/1</a></td><td>Fetch the configuration of a specific site.</td></tr>
  21. <tr><td valign="top"><a href="#get_site_contexts-0">get_site_contexts/0</a></td><td>Return a list of contexts initialized for all active sites.</td></tr>
  22. <tr><td valign="top"><a href="#get_sites-0">get_sites/0</a></td><td>Return a list of active site names.</td></tr>
  23. <tr><td valign="top"><a href="#get_sites_all-0">get_sites_all/0</a></td><td>Return a list of all site names.</td></tr>
  24. <tr><td valign="top"><a href="#get_sites_status-0">get_sites_status/0</a></td><td>Return a list of all sites and their status.</td></tr>
  25. <tr><td valign="top"><a href="#handle_call-3">handle_call/3</a></td><td>Return the active sites.</td></tr>
  26. <tr><td valign="top"><a href="#handle_cast-2">handle_cast/2</a></td><td>Sync known sites with loaded sites.</td></tr>
  27. <tr><td valign="top"><a href="#handle_info-2">handle_info/2</a></td><td>Handling all non call/cast messages.</td></tr>
  28. <tr><td valign="top"><a href="#init-1">init/1</a></td><td>Initiates the server.</td></tr>
  29. <tr><td valign="top"><a href="#restart-1">restart/1</a></td><td>Restart a site.</td></tr>
  30. <tr><td valign="top"><a href="#start-1">start/1</a></td><td>Start a site.</td></tr>
  31. <tr><td valign="top"><a href="#start_link-0">start_link/0</a></td><td>Starts the server.</td></tr>
  32. <tr><td valign="top"><a href="#stop-1">stop/1</a></td><td>Stop a site.</td></tr>
  33. <tr><td valign="top"><a href="#terminate-2">terminate/2</a></td><td>This function is called by a gen_server when it is about to
  34. terminate.</td></tr>
  35. <tr><td valign="top"><a href="#update_dispatchinfo-0">update_dispatchinfo/0</a></td><td>Update the webmachine dispatch information.</td></tr>
  36. <tr><td valign="top"><a href="#upgrade-0">upgrade/0</a></td><td>Sync the supervised sites with the sites in the sites directory.</td></tr>
  37. </table>
  38. <h2><a name="functions">Function Details</a></h2>
  39. <h3 class="function"><a name="code_change-3">code_change/3</a></h3>
  40. <div class="spec">
  41. <p><tt>code_change(OldVsn, State, Extra) -&gt; {ok, NewState}</tt></p>
  42. </div><p>Convert process state when code is changed</p>
  43. <h3 class="function"><a name="get_fallback_site-0">get_fallback_site/0</a></h3>
  44. <div class="spec">
  45. <p><tt>get_fallback_site() -&gt; atom() | undefined</tt></p>
  46. </div><p>Return the name of the site to handle unknown Host requests</p>
  47. <h3 class="function"><a name="get_site_config-1">get_site_config/1</a></h3>
  48. <div class="spec">
  49. <p><tt>get_site_config(Site::atom()) -&gt; SiteProps::list() | {error, Reason}</tt></p>
  50. </div><p>Fetch the configuration of a specific site.</p>
  51. <h3 class="function"><a name="get_site_contexts-0">get_site_contexts/0</a></h3>
  52. <div class="spec">
  53. <p><tt>get_site_contexts() -&gt; [Context]</tt></p>
  54. </div><p>Return a list of contexts initialized for all active sites.</p>
  55. <h3 class="function"><a name="get_sites-0">get_sites/0</a></h3>
  56. <div class="spec">
  57. <p><tt>get_sites() -&gt; [atom()]</tt></p>
  58. </div><p>Return a list of active site names.</p>
  59. <h3 class="function"><a name="get_sites_all-0">get_sites_all/0</a></h3>
  60. <div class="spec">
  61. <p><tt>get_sites_all() -&gt; [atom()]</tt></p>
  62. </div><p>Return a list of all site names.</p>
  63. <h3 class="function"><a name="get_sites_status-0">get_sites_status/0</a></h3>
  64. <div class="spec">
  65. <p><tt>get_sites_status() -&gt; PropList</tt></p>
  66. </div><p>Return a list of all sites and their status.</p>
  67. <h3 class="function"><a name="handle_call-3">handle_call/3</a></h3>
  68. <div class="spec">
  69. <p><tt>handle_call(Message::Request, From, State) -&gt; {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}</tt></p>
  70. </div><p>Return the active sites</p>
  71. <h3 class="function"><a name="handle_cast-2">handle_cast/2</a></h3>
  72. <div class="spec">
  73. <p><tt>handle_cast(Message::Msg, State) -&gt; {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}</tt></p>
  74. </div><p>Sync known sites with loaded sites</p>
  75. <h3 class="function"><a name="handle_info-2">handle_info/2</a></h3>
  76. <div class="spec">
  77. <p><tt>handle_info(Info, State) -&gt; {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}</tt></p>
  78. </div><p>Handling all non call/cast messages</p>
  79. <h3 class="function"><a name="init-1">init/1</a></h3>
  80. <div class="spec">
  81. <p><tt>init(X1::Args) -&gt; {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}</tt></p>
  82. </div><p>Initiates the server.</p>
  83. <h3 class="function"><a name="restart-1">restart/1</a></h3>
  84. <div class="spec">
  85. <p><tt>restart(Site) -&gt; any()</tt></p>
  86. </div><p>Restart a site.</p>
  87. <h3 class="function"><a name="start-1">start/1</a></h3>
  88. <div class="spec">
  89. <p><tt>start(Site) -&gt; any()</tt></p>
  90. </div><p>Start a site.</p>
  91. <h3 class="function"><a name="start_link-0">start_link/0</a></h3>
  92. <div class="spec">
  93. <p><tt>start_link() -&gt; {ok, Pid} | ignore | {error, Error}</tt></p>
  94. </div><p>Starts the server</p>
  95. <h3 class="function"><a name="stop-1">stop/1</a></h3>
  96. <div class="spec">
  97. <p><tt>stop(Site) -&gt; any()</tt></p>
  98. </div><p>Stop a site.</p>
  99. <h3 class="function"><a name="terminate-2">terminate/2</a></h3>
  100. <div class="spec">
  101. <p><tt>terminate(Reason, State) -&gt; <a href="#type-void">void()</a></tt></p>
  102. </div><p>This function is called by a gen_server when it is about to
  103. terminate. It should be the opposite of Module:init/1 and do any necessary
  104. cleaning up. When it returns, the gen_server terminates with Reason.
  105. The return value is ignored.</p>
  106. <h3 class="function"><a name="update_dispatchinfo-0">update_dispatchinfo/0</a></h3>
  107. <div class="spec">
  108. <p><tt>update_dispatchinfo() -&gt; any()</tt></p>
  109. </div><p>Update the webmachine dispatch information. Collects dispatch information from all sites and sends it
  110. to webmachine for updating its dispatch lists and host information.</p>
  111. <h3 class="function"><a name="upgrade-0">upgrade/0</a></h3>
  112. <div class="spec">
  113. <p><tt>upgrade() -&gt; any()</tt></p>
  114. </div><p>Sync the supervised sites with the sites in the sites directory.
  115. Removes and stops deleted sites, adds (but does not start) new sites.</p>
  116. <hr>
  117. <div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
  118. <p><i>Generated by EDoc, Aug 12 2011, 20:01:39.</i></p>
  119. </body>
  120. </html>