Steps to reproduce:

  • add new block
  • add cache setting for this new block (for example Per page)
  • now we should have new rows in blockcache_alter table
  • delete the block you just created
  • now blockcache_alter still has rows related to the block that was removed, leading to PHP notices/warnings in some situations

I see that dev version has commits for fixing the PHP notice http://drupalcode.org/project/blockcache_alter.git/commit/76040ecb7de22a... but this doesn’t fix the root problem. There needs to be some kind of cleanup for blockcache_alter table when blocks are deleted.

Comments

fabianx’s picture

Yeah, it is right, but not too big of a deal to leave old information in the database.

I am happy to accept a patch though - if someone wants to make one.

corentin.crouvisier’s picture

Same problem for me.
I've generate a simple patch based on .dev changes for this issue.

I thinks it would be important to add a cleanup script to remove entries from blockcache_alter table for removed blocks (disabled modules, programmatically disabled, ...).

fabianx’s picture

Status: Active » Reviewed & tested by the community

.

nedjo’s picture

It would be good to be able to clear out the stale data when rows are deleted from the block table, but there doesn't appear to be a great way of doing so, since rows are deleted through various different calls in block module and potentially elsewhere. _block_rehash() calls drupal_alter('block_info',...) before deleting obsolete rows, so one option would be to respond to that and do the same. But a fuller solution would need to emulate block_modules_uninstalled() and various other calls, and would still miss deletions in contrib.

fabianx’s picture

Title: Blockcache_alter database table is not updated when block is deleted, causes bad data and PHP notices » Blockcache_alter database table is not updated when block is deleted, causes superfluous data
Status: Reviewed & tested by the community » Active

#2 is already applied, back to active.

devad’s picture

Just confirming that this issue is still relevant.

Tested with latest stabile 7.x-1.1 and Nodeblock module. After Node (and automatically nodeblock) is deleted - superfluous block data remains in blockcache_alter database table.

I'm also hiding patch #2 since it is implemented into 7.x-1.1 already and this issue needs new patch related to issue title.