Commit d9fb98f7 authored by Gábor Hojtsy's avatar Gábor Hojtsy

Issue #1173012 by carlos8f, Fabianx, Gábor Hojtsy: do not remove blocks for...

Issue #1173012 by carlos8f, Fabianx, Gábor Hojtsy: do not remove blocks for disabled modules in _block_rehash() to avoid blocks disappearing for people following the update guide to the letter disabling contrib modules when updating Drupal core
parent ae71f5d4
......@@ -301,8 +301,12 @@ function _block_rehash($theme = NULL) {
// Remove blocks that are no longer defined by the code from the database.
foreach ($old_blocks as $module => $old_module_blocks) {
foreach ($old_module_blocks as $delta => $block) {
db_query("DELETE FROM {blocks} WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $module, $delta, $theme);
// This cleanup does not apply to disabled modules, to avoid configuration
// being lost when modules are disabled.
if (module_exists($module)) {
foreach ($old_module_blocks as $delta => $block) {
db_query("DELETE FROM {blocks} WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $module, $delta, $theme);
}
}
}
return $blocks;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment