function forum_update_8000() {
  $map = db_query('SELECT vid, machine_name FROM {taxonomy_vocabulary}')->fetchAllKeyed();
  $forum_vid = update_variable_get('forum_nav_vocabulary', FALSE);
  if (!empty($map[$forum_vid])) {
    // Update the variable to reference the machine name instead of the vid.
    update_variable_set('forum_nav_vocabulary', $map[$forum_vid]);
  }
  update_variables_to_config('forum.settings', array(
    'forum_hot_topic' => 'topics.hot_threshold',
    'forum_per_page' => 'topics.page_limit',
    'forum_order' => 'topics.order',
    'forum_nav_vocabulary' => 'vocabulary',
    'forum_block_num_active' => 'block.active.limit',
    'forum_block_num_new' => 'block.new.limit',
  ));
}

See parent issue #2181257: [meta] Variables to config migration [d7] for instructions.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miguelc303’s picture

I did a patch to enable end users to migrate Forum Settings Configuration from Drupal 7 to Drupal 8.
Test(s) (and maybe a dump file) still need to be written.

miguelc303’s picture

Added organization support to Anexus IT

jcost’s picture

Project: IMP » Drupal core
Version: » 8.0.x-dev
Component: Code » migration system
Status: Active » Needs work

Will need to be submitted again to Core since moving from sandbox.

phenaproxima’s picture

Needs to be merged with the parent issue.

phenaproxima’s picture

Status: Needs work » Postponed
FileSize
4.55 KB

Updated for HEAD and wrote a test. But...because this migration depends on d7_taxonomy_vocabulary, it is flat-out blocked by #2410875: Migration for Drupal 7 Taxonomy vocabularies and terms.

phenaproxima’s picture

Status: Postponed » Active

Unblocked!

quietone’s picture

Status: Active » Needs review
FileSize
4.19 KB

Reroll

phenaproxima’s picture

Status: Needs review » Needs work

A few things jump out at me, but otherwise this is good to go.

  1. +++ b/core/modules/forum/migration_templates/d7_forum_settings.yml
    @@ -0,0 +1,35 @@
    +dependencies:
    +  config:
    +    - d7_taxonomy_vocabulary
    +  module:
    +    - forum
    +    - migrate_drupal
    

    Per @alexpott, config dependencies are not allowed in migration templates, so all this needs to be removed.

  2. +++ b/core/modules/forum/src/Tests/Migrate/d7/MigrateForumSettingsTest.php
    @@ -0,0 +1,60 @@
    +    $id_mappings = [
    +      'd7_taxonomy_vocabulary' => [
    +        [[2], ['forum_topics']],
    +      ],
    +    ];
    +    $this->prepareMigrations($id_mappings);
    

    Let's not do this prepareMigrations() stuff -- just run the dependent migration directly (as well as any dependencies it has) using executeMigration().

  3. +++ b/core/modules/forum/src/Tests/Migrate/d7/MigrateForumSettingsTest.php
    @@ -0,0 +1,60 @@
    +  public function testForumSettings() {
    

    Can this be renamed to testForumSettingsMigration()?

quietone’s picture

quietone’s picture

Status: Needs work » Needs review

The last submitted patch, 5: 2353703-5.patch, failed testing.

The last submitted patch, 5: 2353703-5.patch, failed testing.

The last submitted patch, 1: variable_to_config-2353703-1.patch, failed testing.

The last submitted patch, 1: variable_to_config-2353703-1.patch, failed testing.

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

This pleases my eyes and my brain. And DrupalCI. RTBC!

quietone’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
4 KB

Reroll

mikeryan’s picture

Status: Needs review » Reviewed & tested by the community

Yep, just rerolled Variable.php, restoring RTBC.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.0.x. Thanks!

  • webchick committed 4fce2f9 on 8.0.x
    Issue #2353703 by quietone, phenaproxima, miguelc303, ksenzee: Variable...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.