-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Update bootstrapping and configuration in 3.0 #860
Conversation
Remove core.php it is no longer required.
Add default config files for email and datasources. Both config() methods are still not implemented.
Squash and revert a number of changes as they were just a bad idea.
Complete transition to using Configure for configuration.
* Update App/Config/cache.php to use Configure. * Remove Cache::isInitialized() as it is no longer required. * Add Cache::engine() this method allows lazy construction of cache engines. It also encapsulates checks for Cache.disable. * Update methods to use new methods. * Add several tests for set() as it had fairly sparse coverage and some common cases werw missing. * Missing cache configurations now trigger warnings about their absencse instead of silently returning false. While this may be too noisy in some situations, having silent failures makes debugging difficult as you are entirely unaware that no work isn't being done.
This will help people upgrade eaiser than just removing the method.
This can be helpful when doing testing, or if you have a CacheEngine that requires setup that is not feasible with the standard process.
Logging will soon be configured through Configure like other configurable parts of CakePHP.
Remove many the legacy features like: * Autoconfiguration of a file logger. You should remember to configure a logger if you want logging. * Ability to add/modify logging levels. There is really no reason for this functionality to exist. It was primarily a BC work around for people logging random messages and wanting them to show up in different log files. Logging scopes accomplish this in a far more extensible manner. * Removed the ability to log to undefined log levels. write() now returns false when you've logged to nothing. * When using defined levels/scopes both the scope & level of a message must intersect with the loggers scope/message or the message will be ignored. This makes logging more strict, but more predicatable.
Both these exception classes have very few callers and really don't offer the end user any additional information beyond a type.
* With only one thrower this exception was not worth its weight. Replace with the base CakePHP exception. * Update + fix tests for Cake\Model\Datasource\Session.
Awesome! 👍 |
👍 |
*/ | ||
Configure::write('Acl', [ | ||
'database' => 'default', | ||
'classname', 'DbAcl', |
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.
Shouldn't it be 'className' => 'DbAcl'
?
👍 too |
/** | ||
* Once configured, set the error/exception handlers to PHP's default handlers. | ||
*/ | ||
Configure::setErrorHandlers(); |
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.
Can we move this function into the App class?
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 don't see why not.
Nice work mark! One thing I was thinking is, can we still keep the dot notation for plugins? I find it boring having to specify the full class name for a class I want true in an engine. It is obviously cool and powerful being able to do so, but I don't expect everyone to remember exactly what the path is for each class |
@lorenzo Yes. All classes that load others classes support dot notation or "partial" name. Having the full class name is just a faster way. |
Oh, cool :) |
Its no longer used and often a lie when path bootstrapping is used.
It works again.
I think I've addressed most of the comments. If there isn't anything else, I'll merge this in and start working on the next bit. Which will probably be restoring AllTests with incomplete test markers, as right now the test suite isn't overly usable. |
Update bootstrapping and configuration in 3.0
Following the discussion on cakephp-core I've implemented most of the changes discussed but I'll reiterate some of the most important changes again.
include_path
has been temporarily removed, but will come back when I start work on integrating composer.Changes to Log and Cache
Both
Cache
andLog
now feature anengine()
method. This method can be used to directly inject dependencies and fetch instances. It also allowsCache
to lazily load all engines, which could help performance. Similarly,Log
lazy loads loggers upon the first call towrite()
.Exceptions removed
A number of exceptions with very few uses have been removed. There was no real benefit from having additional marker exception classes.
Edit Finished the description, I accidentally submitted too soon.