diff --git a/core/modules/migrate_drupal/config/optional/migrate.migration.d7_statistics_settings.yml b/core/modules/migrate_drupal/config/optional/migrate.migration.d7_statistics_settings.yml new file mode 100644 index 0000000..64d9683 --- /dev/null +++ b/core/modules/migrate_drupal/config/optional/migrate.migration.d7_statistics_settings.yml @@ -0,0 +1,24 @@ +id: d7_statistics_settings +label: Drupal 7 statistics configuration +migration_tags: + - Drupal 7 +source: + plugin: variable + variables: + - statistics_enable_access_log + - statistics_flush_accesslog_timer + - statistics_count_content_views + - statistics_block_top_day_num + - statistics_block_top_all_num + - statistics_block_top_last_num +process: + 'access_log/enabled': statistics_enable_access_log + 'access_log/max_lifetime': statistics_flush_accesslog_timer + 'count_content_views': statistics_count_content_views +destination: + plugin: config + config_name: statistics.settings +dependencies: + module: + - migrate_drupal + - statistics diff --git a/core/modules/migrate_drupal/src/Tests/Table/d7/Variable.php b/core/modules/migrate_drupal/src/Tests/Table/d7/Variable.php index f6faf11..e9c9158 100644 --- a/core/modules/migrate_drupal/src/Tests/Table/d7/Variable.php +++ b/core/modules/migrate_drupal/src/Tests/Table/d7/Variable.php @@ -290,6 +290,15 @@ public function load() { 'name' => 'site_slogan', 'value' => 's:10:"The Slogan";', ))->values(array( + 'name' => 'statistics_block_top_all_num', + 'value' => 'i:55;', + ))->values(array( + 'name' => 'statistics_block_top_day_num', + 'value' => 'i:30;', + ))->values(array( + 'name' => 'statistics_block_top_last_num', + 'value' => 'i:9;', + ))->values(array( 'name' => 'statistics_count_content_views', 'value' => 'i:1;', ))->values(array( @@ -419,4 +428,4 @@ public function load() { } } -#dfc4cdd451a6575677b8c10442893d26 +#f031f5316a5ea2af530fa547bec0538d diff --git a/core/modules/migrate_drupal/src/Tests/d7/MigrateStatisticsSettingsTest.php b/core/modules/migrate_drupal/src/Tests/d7/MigrateStatisticsSettingsTest.php new file mode 100644 index 0000000..3e6ce52 --- /dev/null +++ b/core/modules/migrate_drupal/src/Tests/d7/MigrateStatisticsSettingsTest.php @@ -0,0 +1,45 @@ +installConfig(['statistics']); + $this->loadDumps([ + $this->getDumpDirectory() . '/Variable.php', + ]); + $migration = Migration::load('d7_statistics_settings'); + (new MigrateExecutable($migration, $this))->import(); + } + + /** + * Tests migration of Statistics variables to configuration. + */ + public function testMigration() { + $config = \Drupal::config('statistics.settings')->get(); + $this->assertTrue($config['access_log']['enabled']); + $this->assertEqual(3600, $config['access_log']['max_lifetime']); + $this->assertTrue($config['count_content_views']); + } + +}