From 7aed9239088b582a065da3fb63796ff66cd357c8 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 26 May 2009 05:28:59 +0000 Subject: Restructure the module lifecycle. Install: _installer::install() is called, any necessary tables are created. Activate: _installer::activate() is called. Module controllers are routable, helpers are accessible, etc. The module is in use. Deactivate: _installer::deactivate() is called. Module code is not accessible or routable. Module is *not* in use, but its tables are still around. Uninstall: _installer::uninstall() is called. Module is completely removed from the database. Admin > Modules will install and activate modules, but will only deactivate (will NOT uninstall modules). --- core/helpers/core.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'core/helpers/core.php') diff --git a/core/helpers/core.php b/core/helpers/core.php index 5023bb15..63f51f86 100644 --- a/core/helpers/core.php +++ b/core/helpers/core.php @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class core_Core { + /** + * If Gallery is in maintenance mode, then force all non-admins to get routed to a "This site is + * down for maintenance" page. + */ static function maintenance_mode() { $maintenance_mode = Kohana::config("core.maintenance_mode", false, false); @@ -27,4 +31,22 @@ class core_Core { Router::$method = "index"; } } + + /** + * This function is called when the Gallery is fully initialized. We relay it to modules as the + * "gallery_ready" event. Any module that wants to perform an action at the start of every + * request should implement the _event::gallery_ready() handler. + */ + static function ready() { + module::event("gallery_ready"); + } + + /** + * This function is called right before the Kohana framework shuts down. We relay it to modules + * as the "gallery_shutdown" event. Any module that wants to perform an action at the start of + * every request should implement the _event::gallery_shutdown() handler. + */ + static function shutdown() { + module::event("gallery_shutdown"); + } } \ No newline at end of file -- cgit v1.2.3