We have two blocks in the header of our main page of our dev version. The display order recently got reversed, despite what the blocks interface was telling me. I reordered the blocks in the interface again and the error corrected itself, but this started me looking at the blocks table. I see that a new bid is created for every instance in every theme. We have about 3 or 4 old themes that have been removed from that instance, but the rows in the blocks table referring to them remain. Is this info supposed to get cleared out when you properly deactivate and uninstall a theme? It's possible we just deactivated and then deleted the theme folder.
Thanks,
Elizabeth
Comments
Comment #2
Collins405 CreditAttribution: Collins405 commentedI have just noticed this as well, what are the implications of deleting these from the block table?
Comment #3
Collins405 CreditAttribution: Collins405 commentedComment #4
Collins405 CreditAttribution: Collins405 commentedComment #5
jalpesh CreditAttribution: jalpesh as a volunteer and at Cybage Software Pvt Ltd. commentedHi,
I don't see this functionality as bug. It may possible that user can enable/disable more then one theme to check which one suit best to website. The block entry will remain as it is because it may possible that user install same theme which was enable in past. All the setting like block assigning in region done in past will not required to do it again.
Let me know in case if you have still confusion in it.
Comment #6
Collins405 CreditAttribution: Collins405 commented@jalpesh So how would one clear these? Is it safe to just delete the database rows, or better to re-enable the theme and disable/delete blocks there?
Comment #7
jalpesh CreditAttribution: jalpesh as a volunteer and at Cybage Software Pvt Ltd. commentedIt is batter if you re-enable and remove all block from theme and then disable it instead of deleting from DB. It may possible direct row delete from DB cause issue in future.
Comment #9
ressa CreditAttribution: ressa at Ardea commentedI ran into this after upgrading a web site from Drupal 7 to Drupal 9, originally started in Drupal 5.
After exporting the config files, I noticed quite a few left over ghost blocks from previous themes that were installed over the years, golden oldies such as Bluemarine and BlueBreeze with files such as
block.block.bluebreeze_user_login.yml
. I tried removing the config files and importing the config, but got a lot of dependency errors and missing theme, which blocked it.My solution was to create a minimal theme with the same name:
... and install and uninstall the theme with
drush theme:enable bluebreeze
anddrush theme:uninstall bluebreeze
.After that I could verify that the theme and blocks had been fully removed from the system:
I renamed the folder and file to
bluemarine
andbluemarine.info.yml
, and cleaned up those blocks, etc.I hope it helps someone :-)
Comment #12
candelas CreditAttribution: candelas as a volunteer commentedI am having the same problem. Thanks @ressa . I go to test your solution.
Comment #13
candelas CreditAttribution: candelas as a volunteer commentedBuf, when I try to import one image style, I get like 25 problems with old themes (since Drupal 5) that don't let to me.
So I went to the database and search them and delete. I put here one example, just in case someone finds this. Also I don't understand why an image style has to give this errors. I translate because the errors are in Catalan (though as an admin I have English). I try to import with drush, so this is what my terminal gets.
The error
The configuration <em class="placeholder">block.block.adminimal_system_main</em> depend on the theme <em class="placeholder">adminimal</em> that will not be installed after import.
The sql to delete it
DELETE FROM `key_value` WHERE `key_value`.`collection` = 'config.entity.key_store.block' AND `key_value`.`name` = 'theme:adminimal';
Comment #14
ressa CreditAttribution: ressa at Ardea commentedThanks for sharing @candelas. Would this be safe to use? Of course only if Adminimal theme will not be used any longer:
drush sql:query "DELETE FROM `key_value` WHERE `key_value`.`name` = 'theme:adminimal';"
In case you still have a back up of the database, it would be interesting to find a command which can clear all blocks from an ancient, removed theme.
Comment #15
candelas CreditAttribution: candelas as a volunteer commentedThe problem is that each of us will have different ones.
And if you make a database backup, you are not using anymore the adminimal theme, you can run that command without problem.
At the end, I have used this drush command
drush sql:query "DELETE FROM config WHERE name IN ('block.block.bluebreeze_new_fixed_user_login ', 'block.block.bluebreeze_new_node_syndicate', 'block.block.bluebreeze_new_search_form', 'block.block.bluebreeze_new_user_login', 'block.block.bluebreeze_node_syndicate', 'block.block.bluebreeze_search_form', 'block.block.bluebreeze_user_login', 'block.block.bluemarine_node_syndicate', 'block.block.bluemarine_user_login', 'block.block.bootstrap_block_8', 'block.block.bootstrap_system_main', 'block.block.bootstrap_user_login', 'block.block.box_grey_node_syndicate', 'block.block.box_grey_search_form', 'block.block.box_grey_user_login', 'block.block.garland_block_15', 'block.block.garland_block_8', 'block.block.garland_block_9', 'block.block.garland_menu_menu_collaboration', 'block.block.garland_node_syndicate', 'block.block.garland_system_main', 'block.block.garland_user_login', 'block.block.jul_fixed_node_syndicate', 'block.block.jul_fixed_search_form', 'block.block.jul_fixed_user_login', 'block.block.jul_node_syndicate', 'block.block.jul_search_form', 'block.block.jul_user_login', 'block.block.lela_block_15', 'block.block.lela_block_8', 'block.block.lela_block_9', 'block.block.lela_menu_menu_collaboration', 'block.block.lela_node_syndicate', 'block.block.lela_search_form', 'block.block.lela_system_main', 'block.block.lela_user_login', 'block.block.seven_block_17', 'block.block.seven_menu_menu_collaboration', 'block.block.seven_search_form', 'block.block.seven_system_main', 'block.block.stark_search_form', 'block.block.stark_system_main', 'bluebreeze-fixed.settings', 'bluebreeze.settings', 'bluemarine.settings', 'box.settings', 'jul.settings', 'language.content_settings.menu_link_content.menu_link_content', 'lela.settings')"
Comment #16
ressa CreditAttribution: ressa at Ardea commentedI agree, every Drupal installation's lingering left over theme cruft will be unique, for sure. My thinking is just that for example for me, I only had left over block references from two themes, so in my case it might have been enough to run these two commands, as opposed to my workaround to create a dummy-theme (#9):
Similarly, in your case, these commands might have take care of most old references for you (though
box
might not have been a theme?):