Steve Perks
Steve Perks

Reputation: 5530

How do I find out if a block is being used on my Drupal site?

I'm wanting to remove a module from my Drupal 6.x sites.

I've identified that the module is only being used in one block and now have to trawl through 8 sites * 30 contexts to make sure it's removed. Is there a quicker way to identify if my block is being used and where?

UPDATE: I'm using contexts to control my content placement, so viewing admin/build/blocks doesn't do me any favors.

Upvotes: 3

Views: 2102

Answers (3)

Sam Michel
Sam Michel

Reputation: 106

Had the same problem. Found a clunky way of doing it that involved using the DB.

First up, get the machine name of the block from the admin/build/blocks page e.g. block-74 then you can run a SELECT on the context table to get the contexts that are using the block.

SELECT name FROM context WHERE reactions LIKE '%block-74%'

replacing the table name and block name depending on your install. Hope that helps. Haven't tested mega-thoroughly, but seemed to work OK for hunting down those tricky blocks.

Upvotes: 3

smthomas3
smthomas3

Reputation: 121

I am not sure if this fits your situation, but if accessing the database for these sites is faster you may be able to tell that way.

Drupal 6 has a "blocks" table that lists all the blocks on the site as they are configured for each enabled theme. This means you can use the "module" field and "status" field to filter a query that searches if any blocks are enabled for that module. You can then either hop into the admin interface and disable them, or you can run a database update and just set their status to 0 to disable the block.

Hopefully that helps.

Upvotes: -1

Laxman13
Laxman13

Reputation: 5211

If I understand you correctly... check out admin/build/block. There you can see all the blocks available, what regions they are placed, and can access their configurations (display to users, what pages to display on, etc).

Go through the list and if you don't see the block, it will not be in use.

Upvotes: 0

Related Questions