Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
As a result of an upgrades and theme changes, not all of a site's blocks can be assumed to have database rows. Because the block module only runs UPDATE to save block settings, blocks without existing rows don't get saved.
The easiest solution is to add @db_query('INSERT INTO {blocks} (module, delta, theme) VALUES ("%s", "%s", "%s")', $block['module'], $block['delta'], $block['theme']);
directly before the UPDATE query in block_admin_display_form_submit
.
Comments
Comment #1
Coornail CreditAttribution: Coornail commentedI would prefer to useON DUPLICATE KEY UPDATE
(MySQL manual).That's a mysql specific thing =(
Comment #2
dpearcefl CreditAttribution: dpearcefl commentedIs this still an issue in modern Drupal?
Comment #3
dpearcefl CreditAttribution: dpearcefl commented