Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new method Kohana::init_modules() #530

Merged
merged 1 commit into from
Aug 13, 2014
Merged

Create new method Kohana::init_modules() #530

merged 1 commit into from
Aug 13, 2014

Conversation

lenton
Copy link
Contributor

@lenton lenton commented Aug 7, 2014

This PR splits the module initialisation functionality from Kohana::modules() and places it into its own method called Kohana::init_modules().

Previous PRs to the 3.4/develop branch has forced Kohana::modules() to be called in the bootstrap before any classes are used. This causes a problem because a few things need to be done before the modules are initialised such as attaching a config object to Kohana::$config (the userguide uses this for example https://github.com/kohana/userguide/blob/3.3/master/init.php#L12).

To fix this problem, the method Kohana::init_modules() can be called after everything has been set up for init files in the bootstrap.

@enov
Copy link
Contributor

enov commented Aug 8, 2014

@lenton adding the core as a simple module is making things slightly complicated.

Theoretically speaking, using classes of the modules (and core) should be done after proper initialization of modules (and core).

@acoulton
Copy link
Member

acoulton commented Aug 8, 2014

@lenton I'm also not sure about this - some modules add autoloaders or otherwise register additional classes outside the CFS. It has potential to be slightly confusing if the system is part usable (and some classes have to be used) between Kohana::modules and Kohana::init_modules.

This and the issues over __/I18N makes me think that maybe we should just revert to core being available by default.

@lenton
Copy link
Contributor Author

lenton commented Aug 8, 2014

This makes the module's init files load at the same time as they do in 3.3 so there's going to be absolutely no problems for existing init files out there. It also completely solves the __() issue and makes it available to init files too.

@enov
Copy link
Contributor

enov commented Aug 10, 2014

I'll merge this soon if there are no other objection on this.

@enov enov self-assigned this Aug 10, 2014
@enov
Copy link
Contributor

enov commented Aug 13, 2014

@lenton , what's the order of running the init.php of the modules?

I suggest, if it is not already the case, that lower modules (those defined later) should have their init.php called/required before upper (those defined first) modules.

@lenton
Copy link
Contributor Author

lenton commented Aug 13, 2014

@enov Yes, that's much more logical but unfortunately Kohana routes have to be set in a top down fashion which means init files can't be loaded in the correct order yet: #524.

enov added a commit that referenced this pull request Aug 13, 2014
Create new method Kohana::init_modules()
@enov enov merged commit 3ae2b5e into kohana:3.4/develop Aug 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants