Skip to content

Commit

Permalink
Merge pull request #530 from lenton/3.4/feature/init-modules-method
Browse files Browse the repository at this point in the history
Create new method Kohana::init_modules()
  • Loading branch information
enov committed Aug 13, 2014
2 parents ce00ffd + ef209eb commit 3ae2b5e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions classes/Kohana/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 3ae2b5e

Please sign in to comment.