With the container, and the possibility that page caching is going to be replaced by HttpCache, bootstrap hooks don't really have a place any more. They all have some kind of use case, but usually that use case can be handled by some other mechanism.
Opening this meta-issue to track various issues that have already been open for a while, see discussion in those for more details. This one can also handle removing the bootstrap column in the system table, bootstrap_invoke_all() etc.
#1289536: Switch Watchdog to a PSR-3 logging framework
#1860026: Remove hook_exit() for cached page requests
#1911178: Remove hook_exit()
#1833442: Remove hook_boot()
#1899994: Disentangle language initialization from path resolution
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | 1888734-bootstrap-27.patch | 8.85 KB | catch |
| #18 | interdiff.txt | 653 bytes | katbailey |
| #18 | 1888734_bootstrap.18.patch | 8.83 KB | katbailey |
| #10 | 1888734_bootstrap.patch | 8.19 KB | catch |
| #7 | 1888734.patch | 6.51 KB | catch |
Comments
Comment #1
berdirThis would also allow to remove the page_cache_invoke_hooks variable, which we don't want to convert to CMI I think but can't convert to a setting because we currently can't provide test coverage for settings on page requests as we need a test-writable settings.php for that.
Comment #2
catchAlso page_cache_without_database - since that only bypassed variable_init() and hook invocation.
Comment #3
Anonymous (not verified) commentedyes please.
Comment #4
plachI think
hook_language_init()could be easily removed once #1763640: Introduce config context to make original config and different overrides accessible is in.Comment #5
katbailey commentedhook_language_init()was given the boot in #1899994: Disentangle language initialization from path resolution but I forgot to actually remove it from the array of bootstrap hooks in that patch - tiny follow-up that does that is here: #1907700: Remove language_init from the array of bootstrap hooks as it no longer existsComment #5.0
Crell commentedAdd second hook_exit issue.
Comment #6
benjifisherupdating the title
Comment #7
catchWatchdog is the only remaining hook. We could consider doing this as an interim step until there's a logging service that doesn't have the module system dependency, errors still get displayed by drupal_set_message() if modules aren't loaded yet.
Comment #9
Crell commentedI am OK with #7 as a workaround for the time being (once it actually installs). We should still make sure that #1289536: Switch Watchdog to a PSR-3 logging framework happens regardless, though.
Comment #10
catchThis one installs, also turns out the hacks weren't needed at all.
Comment #11
catchComment #12
catch#1289536: Switch Watchdog to a PSR-3 logging framework just went RTBC but for some reason doesn't contain any of these changes.
Comment #13
ParisLiakos commentedYeah i only made
bootstrap_hooksreturn an empty array, so we kill those stuff here, but i am ok if you want to do this thereComment #14
katbailey commentedIt seems Paris wanted to leave these changes out of the watchdog patch - see #1289536-118: Switch Watchdog to a PSR-3 logging framework
Will wait for testbot before RTBCing but this patch is just lovely :)
Comment #15
catchI don't think the patches conflict much if at all, so seems fine to have two issues given the code's already written.
Comment #17
catchOK that's all the upgrade path tests, no time to look at those for a bit but my guess would be the move of module.inc include to DRUPAL_BOOTSTRAP_CODE.
Comment #18
katbailey commentedOK, let's try this...
Comment #19
Anonymous (not verified) commentedlooks good.
nitpick, there's still a line in the comments for drupal_flush_all_caches() about bootstrap hooks.
Comment #20
Crell commentedJust a note this will conflict with the Watchdog patch, so let's make sure that gets in first as this is easier to reroll.
Comment #21
catchThat's not much of a conflict, and that patch is CNW at the moment.
Comment #22
catch#18: 1888734_bootstrap.18.patch queued for re-testing.
Comment #23
ParisLiakos commentedyeah, it only conflicts on the bootstrap hooks function, one line conflict, dead easy to resolve..i will probably have time to work on the issue there, this weekend, but i would have no problem at all with this being committed in the meantime
Comment #24
no_angel commented#18: 1888734_bootstrap.18.patch queued for re-testing.
Comment #26
no_angel commentedFirst patch re-roll attempt: not able to resolve.
localhost:8.x angelamaunz$ git checkout -b 1888734-bootstrap18 760292ee835
Switched to a new branch '1888734-bootstrap18'
localhost:8.x angelamaunz$ git apply --index 1888734_bootstrap.18.patch
localhost:8.x angelamaunz$ git commit -m "Applying patch from https://drupal.org/node/1888734"
[1888734-bootstrap18 55ca3ac] Applying patch from https://drupal.org/node/1888734
7 files changed, 5 insertions(+), 109 deletions(-)
localhost:8.x angelamaunz$ git rebase 8.x
First, rewinding head to replay your work on top of it...
Applying: Applying patch from https://drupal.org/node/1888734
Using index info to reconstruct a base tree...
M core/includes/bootstrap.inc
M core/includes/common.inc
M core/includes/update.inc
M core/lib/Drupal/Core/Extension/CachedModuleHandler.php
M core/lib/Drupal/Core/Extension/ModuleHandler.php
M core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php
M core/modules/system/system.module
Falling back to patching base and 3-way merge...
Auto-merging core/modules/system/system.module
CONFLICT (content): Merge conflict in core/modules/system/system.module
Auto-merging core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php
Auto-merging core/lib/Drupal/Core/Extension/ModuleHandler.php
Auto-merging core/lib/Drupal/Core/Extension/CachedModuleHandler.php
Auto-merging core/includes/update.inc
Auto-merging core/includes/common.inc
Auto-merging core/includes/bootstrap.inc
Failed to merge in the changes.
Patch failed at 0001 Applying patch from https://drupal.org/node/1888734
The copy of the patch that failed is found in:
/Users/angelamaunz/Sites/8.x/.git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
/**
<<<<<<< HEAD
* Refreshes the list of bootstrap modules.
*
* This is called internally by module_enable/disable() to flag modules that
* implement hooks used during bootstrap, such as hook_watchdog(). These modules
* are loaded earlier to invoke the hooks.
*/
function _system_update_bootstrap_status() {
$bootstrap_modules = array();
foreach (bootstrap_hooks() as $hook) {
foreach (Drupal::moduleHandler()->getImplementations($hook) as $module) {
$bootstrap_modules[$module] = drupal_get_filename('module', $module);
}
}
Drupal::state()->set('system.module.bootstrap', $bootstrap_modules);
}
/**
=======
>>>>>>> Applying patch from https://drupal.org/node/1888734
Comment #27
catchRe-rolled.
Comment #28
chx commentedSo the patch is green. Only watchdog is left and I presume https://drupal.org/node/1289536 could be committed to fix that. The bootstrap mechanism is awkward and chipping away duties from system_rebuild_module_data is a huge win cos we want that function to die a fiery death.
Comment #29
webchickThe impact this will presumably have is in modules if you're trying to invoke watchdog() early enough, it won't actually work and will just silently fail. I could see this being nastily surprising to people. However, #1289536: Switch Watchdog to a PSR-3 logging framework seems pretty close, which will address that issue for watchdog specifically, and catch also pointed me to #1905334: Only load all modules when a hook gets invoked which solves it more generally.
Otherwise:
That's a nice diffstat. ;)
Committed and pushed to 8.x. Thanks!
We'll need a change notice for this.
Comment #30
catchPosted https://drupal.org/node/2062965
Comment #31.0
(not verified) commentedUpdated issue summary.