[drupal-devel] [bug] Blocks showing up when module disabled
drumm
drupal-devel at drupal.org
Thu Aug 11 22:17:28 UTC 2005
Issue status update for
http://drupal.org/node/13802
Post a follow up:
http://drupal.org/project/comments/add/13802
Project: Drupal
Version: cvs
Component: module system
Category: bug reports
Priority: minor
-Assigned to: Anonymous
+Assigned to: drumm
Reported by: Jose A Reyero
Updated by: drumm
Status: patch (code needs work)
I can work on this.
drumm
Previous comments:
------------------------------------------------------------------------
Thu, 02 Dec 2004 13:19:31 +0000 : Jose A Reyero
This only happens in the module administration page.
To reproduce this behaviour:
1. enable a module and one block provided by it - I.e. 'archive' module
2. disable the module
The block still shows up in the module administration page
I find this more funny than annoying and it happens only in module
admin page.
Anyway, think it's and undesirable behaviour and should be addressed,
maybe at the block management level.
------------------------------------------------------------------------
Thu, 16 Jun 2005 04:37:45 +0000 : deekayen
I verified this in HEAD for the archive module.
------------------------------------------------------------------------
Thu, 11 Aug 2005 20:49:44 +0000 : tostinni
This still apply to HEAD, the procedure to reproduce the bug is the
right one.
However, I don't understand exactly why the block keep appears on this
page, and not on the others pages. The problem is that looking at the
blocks table, "archive" block stay there even if it doesn't appear on
other pages (on module page yes it does). When I enter a new page,
saying home, archive block isn't there but is still on the db.
The cache is flushed, because archive seems not to appear on the entry
giving me the menu, but the current page keep the old cache entry (well
I guess).
Ok so I proposed a radical way to correct this : rehashing blocks after
saving the module configuration. So I just add a _block_rehash(); after
the menu_rebuild();, it's a little dirty but do the trick. If you have
any suggestion about a better way to do this ;)
<?php
function system_listing_save($edit = array()) {
$op = $_POST['op'];
$edit = $_POST['edit'];
if ($op == t('Save configuration')) {
db_query("UPDATE {system} SET status = 0 WHERE type = '%s'",
$edit['type']);
foreach ($edit['status'] as $name => $status) {
// Make certain that the default theme is enabled to avoid
user error
if (($edit['type'] == 'theme') && ($edit['theme_default']
== $name)) {
$status = 1;
}
db_query("UPDATE {system} SET status = %d, throttle = %d
WHERE type = '%s' AND name = '%s'", $status, $edit['throttle'][$name],
$edit['type'], $name);
}
if ($edit['type'] == 'theme') {
variable_set('theme_default', $edit['theme_default']);
}
menu_rebuild();
_block_rehash();
drupal_set_message(t('The configuration options have been
saved.'));
drupal_goto($_GET['q']);
}
}
?>
More information about the drupal-devel
mailing list