Unverified Commit 6cad09c1 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3108416 by catch, amateescu, alexpott, xjm: Remove workspace_update_8803()

parent 19cf46cc
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1106,14 +1106,16 @@ function system_requirements($phase) {
      }
    }

    // If system.module is in the list then only show a specific message for
    // Drupal core, otherwise show a more generic message for each module.
    if (isset($module_list['system'])) {
    // If system or workspaces is in the list then only show a specific message
    // for Drupal core.
    if (isset($module_list['system']) || isset($module_list['workspaces'])) {
      $requirements['system_update_last_removed'] = [
        'title' => t('The version of Drupal you are trying to update from is too old'),
        'description' => t('Updating to Drupal @current_major is only supported from Drupal version @required_min_version or higher. If you are trying to update from an older version, first update to the latest version of Drupal @previous_major. (<a href=":url">Drupal 9 upgrade guide</a>)', [
          '@current_major' => 9,
          '@required_min_version' => '8.8.0',
          // Workspaces is special cased due to updates being removed after
          // 8.8.0.
          '@required_min_version' => isset($module_list['workspaces']) ? '8.8.2' : '8.8.0',
          '@previous_major' => 8,
          ':url' => 'https://www.drupal.org/docs/9/how-to-prepare-your-drupal-7-or-8-site-for-drupal-9/upgrading-a-drupal-8-site-to-drupal-9',
        ]),
+1 −22
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
 * Contains install, update and uninstall functions for the Workspaces module.
 */

use Drupal\Core\Entity\ContentEntityNullStorage;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\workspaces\Entity\Workspace;

@@ -125,25 +124,5 @@ function workspaces_schema() {
 * Implements hook_update_last_removed().
 */
function workspaces_update_last_removed() {
  return 8802;
}

/**
 * Remove the Workspace Association entity storage if necessary.
 */
function workspaces_update_8803() {
  $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $entity_type = $entity_definition_update_manager->getEntityType('workspace_association');

  // We can't migrate the workspace association data if the entity type is not
  // using its default storage.
  // @see workspaces_post_update_move_association_data()
  if ($entity_type && $entity_type->getHandlerClasses()['storage'] === 'Drupal\workspaces\WorkspaceAssociationStorage') {
    \Drupal::state()->set('workspaces_update_8803.tables', [
      'base_table' => $entity_type->getBaseTable(),
      'revision_table' => $entity_type->getRevisionTable(),
    ]);
    $entity_type->setStorageClass(ContentEntityNullStorage::class);
    $entity_definition_update_manager->uninstallEntityType($entity_type);
  }
  return 8803;
}