summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGábor Hojtsy2012-01-23 12:55:34 (GMT)
committer Gábor Hojtsy2012-01-23 12:55:34 (GMT)
commitd9fb98f75d5557425ba1c18dfe068701425833d4 (patch)
treeec32ab7ab18299767a2c5bcfe832d24d07fcfe87
parentae71f5d4d1a46ed7709abfd554519a6b7897f212 (diff)
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
-rw-r--r--modules/block/block.module8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index 2974ce3..f0c499e 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -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;