diff --git a/core/modules/block/block.install b/core/modules/block/block.install index f296e0d..07a0356 100644 --- a/core/modules/block/block.install +++ b/core/modules/block/block.install @@ -99,6 +99,7 @@ function block_update_8001() { * Placeholder for the previous 8002 update. */ function block_update_8002() { + \Drupal::state()->set('block_update_8002', TRUE); } /** diff --git a/core/modules/block/block.post_update.php b/core/modules/block/block.post_update.php index f191ce2..f0325ce 100644 --- a/core/modules/block/block.post_update.php +++ b/core/modules/block/block.post_update.php @@ -20,10 +20,18 @@ function block_post_update_disable_blocks_with_missing_contexts() { // batch is finished. $module_schema = drupal_get_installed_schema_version('block'); - if ($module_schema == 8002) { + // The state entry 'block_update_8002' is used in order to indicate that + // block_update_8002() would have been executed, so this function needs to be + // executed as well. If the non placeholder block_update_8002() got executed + // already the state won't be set, and we skip this update. + // We also need to check whether + if ($module_schema >= 8002 && !\Drupal::state()->get('block_update_8002', FALSE)) { return; } + // Cleanup the state entry as its no longer needed. + \Drupal::state()->delete('block_update_8002'); + $block_update_8001 = \Drupal::keyValue('update_backup')->get('block_update_8001', []); $block_ids = array_keys($block_update_8001);