diff --git a/classes/Kohana/Core.php b/classes/Kohana/Core.php index 503ffedb9..a14ae5b47 100644 --- a/classes/Kohana/Core.php +++ b/classes/Kohana/Core.php @@ -496,18 +496,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; } /**