From ef209eb3f598baf513ed0462dd5483e926d979c5 Mon Sep 17 00:00:00 2001 From: Alex Lenton Date: Thu, 7 Aug 2014 22:59:41 +0100 Subject: [PATCH] Split module initialisation functionality from Kohana::modules() into Kohana::init_modules() --- classes/Kohana/Core.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/classes/Kohana/Core.php b/classes/Kohana/Core.php index 4ac42c6b5..e92fae45a 100644 --- a/classes/Kohana/Core.php +++ b/classes/Kohana/Core.php @@ -499,18 +499,29 @@ public static function modules(array $modules = NULL) // Set the current module list Kohana::$_modules = $modules; + return Kohana::$_modules; + } + + /** + * Initializes the enabled modules. + * + * @return void + */ + public static function init_modules() + { + // For each enabled module foreach (Kohana::$_modules as $path) { - $init = $path.'init'.EXT; + // Get init file path + $init_path = $path.'init'.EXT; - if (is_file($init)) + // If init file exists in module + if (is_file($init_path)) { - // Include the module initialization file once - require_once $init; + // Include the init file + require_once $init_path; } } - - return Kohana::$_modules; } /**