-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: add Boot class #8604
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
feat: add Boot class #8604
Conversation
|
👋 Hi, @kenjis! |
0c2f6d9 to
4b4c026
Compare
4b4c026 to
46c91ca
Compare
|
👋 Hi, @kenjis! |
46c91ca to
5ff0397
Compare
| * the LICENSE file that was distributed with this source code. | ||
| */ | ||
|
|
||
| namespace CodeIgniter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always find it difficult to intercept the boot process. I don't want to overcomplicated this, but would it make sense to have an extension of this in App\ to allow devs to modify the boot process? This class could have necessary methods as final. Alternatively there could be another file like app/Config/Boot/Default.php that is always loaded alongside the environment-specific version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to modify the boot process, extend the Boot class, and run your Boot in index.php.
system/Boot.php
Outdated
| $env = $_ENV['CI_ENVIRONMENT'] ?? $_SERVER['CI_ENVIRONMENT'] ?? getenv('CI_ENVIRONMENT'); | ||
|
|
||
| define('ENVIRONMENT', ($env !== false) ? $env : 'production'); | ||
| unset($env); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This scopes out immediately anyways.
| unset($env); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
We should write FQSEN, but a PHP file is not a FQSEN. @uses [FQSEN] [<description>] https://docs.phpdoc.org/guide/references/phpdoc/tags/uses.html#uses-used-by
9b8fc1b to
61bf440
Compare
The translated error message is no longer provided. This is because the checking must be done at a very early stage.
d64746a to
08dd2c6
Compare
08dd2c6 to
e40baa2
Compare
e40baa2 to
842fd6e
Compare
MGatner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
|
@MGatner Thank you for the review! |
|
I'm curious - is this part of a set of changes coming or was it just to clean things up? Only ask because if it was just to clean it up then we just added a slight bit more overhead and performance cost by using a class where a plain script was doing everything just fine. Granted, it's pretty much negligible but it is a trend we're doing and we're also more and more concerned about performance. |
|
This PR is a part of a series that ends with #8610. I changed the scripts to a class because the scripts were too long and difficult to understand. If the performance loss is really important, we could convert the class to a plain script. |
|
I have moved the location of the .env file in CI v4.4.8. |
|
or we can add path for |
Needs #8603Description
Closes #7824
Bootclass, thenindex.php,spark, andTest/bootstrap.phpuse itsystem/bootstrap.phpChecklist: