Commit 968c43f3 authored by Gabor Hojtsy's avatar Gabor Hojtsy
Browse files

Issue #2687843 by quietone, heddn, Jo Fitzgerald, alexpott, piggito, mallezie,...

Issue #2687843 by quietone, heddn, Jo Fitzgerald, alexpott, piggito, mallezie, mikeryan, xjm, phenaproxima, benjifisher, webchick, Gábor Hojtsy, masipila, benjy, abhishek-anand, catch: Add back incremental migrations through the UI

(cherry picked from commit 669c2ef2)
parent 8023a1c5
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -167,8 +167,10 @@ public function build() {
   */
  public function getCacheTags() {
    $cache_tags = parent::getCacheTags();
    $feed = $this->feedStorage->load($this->configuration['feed']);
    return Cache::mergeTags($cache_tags, $feed->getCacheTags());
    if ($feed = $this->feedStorage->load($this->configuration['feed'])) {
      $cache_tags = Cache::mergeTags($cache_tags, $feed->getCacheTags());
    }
    return $cache_tags;
  }

}
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ protected function setUp() {
    $this->installSchema('forum', ['forum_index']);
    $this->installSchema('node', ['node_access']);
    $this->installSchema('search', ['search_dataset']);
    $this->installSchema('system', ['sequences']);
    $this->installSchema('tracker', ['tracker_node', 'tracker_user']);

    // Enable content moderation for nodes of type page.
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ protected function setUp() {
    $this->installSchema('forum', ['forum_index']);
    $this->installSchema('node', ['node_access']);
    $this->installSchema('search', ['search_dataset']);
    $this->installSchema('system', ['sequences']);
    $this->installSchema('tracker', ['tracker_node', 'tracker_user']);

    // Enable content moderation for nodes of type page.
+142 −63
Original line number Diff line number Diff line
@@ -2,16 +2,6 @@

namespace Drupal\Tests\migrate_drupal\Traits;

use Drupal\aggregator\Entity\Feed;
use Drupal\aggregator\Entity\Item;
use Drupal\block_content\Entity\BlockContent;
use Drupal\comment\Entity\Comment;
use Drupal\file\Entity\File;
use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\node\Entity\Node;
use Drupal\taxonomy\Entity\Term;
use Drupal\user\Entity\User;

/**
 * Provides helper methods for creating test content.
 */
@@ -60,72 +50,161 @@ protected function installEntitySchemas() {
   * Create several pieces of generic content.
   */
  protected function createContent() {
    $entity_type_manager = \Drupal::entityTypeManager();

    // Create an aggregator feed.
    $feed = Feed::create([
    if ($entity_type_manager->hasDefinition('aggregator_feed')) {
      $feed = $entity_type_manager->getStorage('aggregator_feed')->create([
        'title' => 'feed',
        'url' => 'http://www.example.com',
      ]);
      $feed->save();

      // Create an aggregator feed item.
    $item = Item::create([
      $item = $entity_type_manager->getStorage('aggregator_item')->create([
        'title' => 'feed item',
        'fid' => $feed->id(),
        'link' => 'http://www.example.com',
      ]);
      $item->save();
    }

    // Create a block content.
    $block = BlockContent::create([
    if ($entity_type_manager->hasDefinition('block_content')) {
      $block = $entity_type_manager->getStorage('block_content')->create([
        'info' => 'block',
        'type' => 'block',
      ]);
      $block->save();
    }

    // Create a node.
    $node = Node::create([
    if ($entity_type_manager->hasDefinition('node')) {
      $node = $entity_type_manager->getStorage('node')->create([
        'type' => 'page',
        'title' => 'page',
      ]);
      $node->save();

      // Create a comment.
    $comment = Comment::create([
      if ($entity_type_manager->hasDefinition('comment')) {
        $comment = $entity_type_manager->getStorage('comment')->create([
          'comment_type' => 'comment',
          'field_name' => 'comment',
          'entity_type' => 'node',
          'entity_id' => $node->id(),
        ]);
        $comment->save();
      }
    }

    // Create a file.
    $file = File::create([
    if ($entity_type_manager->hasDefinition('file')) {
      $file = $entity_type_manager->getStorage('file')->create([
        'uri' => 'public://example.txt',
      ]);
      $file->save();
    }

    // Create a menu link.
    $menu_link = MenuLinkContent::create([
    if ($entity_type_manager->hasDefinition('menu_link_content')) {
      $menu_link = $entity_type_manager->getStorage('menu_link_content')->create([
        'title' => 'menu link',
        'link' => ['uri' => 'http://www.example.com'],
        'menu_name' => 'tools',
      ]);
      $menu_link->save();
    }

    // Create a taxonomy term.
    $term = Term::create([
    if ($entity_type_manager->hasDefinition('taxonomy_term')) {
      $term = $entity_type_manager->getStorage('taxonomy_term')->create([
        'name' => 'term',
        'vid' => 'term',
      ]);
      $term->save();
    }

    // Create a user.
    $user = User::create([
      'uid' => 2,
    if ($entity_type_manager->hasDefinition('user')) {
      $user = $entity_type_manager->getStorage('user')->create([
        'name' => 'user',
        'mail' => 'user@example.com',
      ]);
      $user->save();
    }
  }

  /**
   * Create several pieces of generic content.
   */
  protected function createContentPostUpgrade() {
    $entity_type_manager = \Drupal::entityTypeManager();

    // Create a block content.
    if ($entity_type_manager->hasDefinition('block_content')) {
      $block = $entity_type_manager->getStorage('block_content')->create([
        'info' => 'Post upgrade block',
        'type' => 'block',
      ]);
      $block->save();
    }

    // Create a node.
    if ($entity_type_manager->hasDefinition('node')) {
      $node = $entity_type_manager->getStorage('node')->create([
        'type' => 'page',
        'title' => 'Post upgrade page',
      ]);
      $node->save();

      // Create a comment.
      if ($entity_type_manager->hasDefinition('comment')) {
        $comment = $entity_type_manager->getStorage('comment')->create([
          'comment_type' => 'comment',
          'field_name' => 'comment',
          'entity_type' => 'node',
          'entity_id' => $node->id(),
        ]);
        $comment->save();
      }
    }

    // Create a file.
    if ($entity_type_manager->hasDefinition('file')) {
      $file = $entity_type_manager->getStorage('file')->create([
        'uri' => 'public://post_upgrade_example.txt',
      ]);
      $file->save();
    }

    // Create a menu link.
    if ($entity_type_manager->hasDefinition('menu_link_content')) {
      $menu_link = $entity_type_manager->getStorage('menu_link_content')->create([
        'title' => 'post upgrade menu link',
        'link' => ['uri' => 'http://www.drupal.org'],
        'menu_name' => 'tools',
      ]);
      $menu_link->save();
    }

    // Create a taxonomy term.
    if ($entity_type_manager->hasDefinition('taxonomy_term')) {
      $term = $entity_type_manager->getStorage('taxonomy_term')->create([
        'name' => 'post upgrade term',
        'vid' => 'term',
      ]);
      $term->save();
    }

    // Create a user.
    if ($entity_type_manager->hasDefinition('user')) {
      $user = $entity_type_manager->getStorage('user')->create([
        'name' => 'universe',
        'mail' => 'universe@example.com',
      ]);
      $user->save();
    }
  }

}
+0 −2
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@ function migrate_drupal_ui_help($route_name, RouteMatchInterface $route_match) {
      $output .= '<dt>' . t('Reviewing the upgrade log') . '</dt>';
      $output .= '<dd>' . t('You can review a <a href=":log">log of upgrade messages</a> by clicking the link in the message provided after the upgrade or by filtering the messages for the type <em>migrate_drupal_ui</em> on the <a href=":messages">Recent log messages</a> page.',
          [':log' => \Drupal::url('migrate_drupal_ui.log'), ':messages' => \Drupal::url('dblog.overview')]) . '</dd>';
      $output .= '<dt>' . t('Incremental upgrades') . '</dt>';
      $output .= '<dd>' . t('Incremental upgrades are not yet supported through the user interface.') . '</dd>';
      $output .= '<dt>' . t('Rolling back an upgrade') . '</dt>';
      $output .= '<dd>' . t('Rolling back an upgrade is not yet supported through the user interface.') . '</dd>';
      $output .= '</dl>';
Loading