diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7805785..717edd4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
## Changelog
+### 5.0.6 - 2026-05-25
+- Added code to ignore migration if no option is provided explicitly
+
### 5.0.6 - 2025-09-29
- Allow annotations migration to work with both option and annotations tables
diff --git a/Commands/Migrate.php b/Commands/Migrate.php
index 7b94947..ff6be04 100644
--- a/Commands/Migrate.php
+++ b/Commands/Migrate.php
@@ -133,6 +133,6 @@ private function makeTargetDb()
private function confirmMigration($idSite): bool
{
- return $this->askForConfirmation('Are you sure you want to migrate the data for idSite ' . (int) $idSite . '. (y/N)');
+ return $this->askForConfirmation('Are you sure you want to migrate the data for idSite ' . (int) $idSite . '. (y/N)', false);
}
}
diff --git a/plugin.json b/plugin.json
index dc3383a..01e2b8b 100644
--- a/plugin.json
+++ b/plugin.json
@@ -1,7 +1,7 @@
{
"name": "Migration",
"description": "Migrate/copy any measurable (site, app, roll-up) from one Matomo to another Matomo",
- "version": "5.0.6",
+ "version": "5.0.7",
"theme": false,
"require": {
"matomo": ">=5.0.0-b1,<6.0.0-b1"
diff --git a/tests/System/Commands/MigrateTest.php b/tests/System/Commands/MigrateTest.php
index cb8e5f6..4dcfe4c 100644
--- a/tests/System/Commands/MigrateTest.php
+++ b/tests/System/Commands/MigrateTest.php
@@ -40,7 +40,7 @@ public function tearDown(): void
public function test_runMigration()
{
$result = $this->runCommand();
- $this->assertEquals('Processing SiteMigration at 2019-01-10 02:48:01
+ $expectedOutput = 'Processing SiteMigration at 2019-01-10 02:48:01
Target site is 1 at 2019-01-10 02:48:01
Processed SiteMigration at 2019-01-10 02:48:01
Processing SiteUrlMigration at 2019-01-10 02:48:01
@@ -72,38 +72,8 @@ public function test_runMigration()
Migrated 90% of visits at 2019-01-10 02:48:01
Migrated 2 visits. The number of migrated visits may be higher if data is still tracked into the source Matomo while migrating the data at 2019-01-10 02:48:01
Processed LogMigration at 2019-01-10 02:48:01
-Processing ArchiveMigration at 2019-01-10 02:48:01
-Found 14 archive tables at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_01 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_01 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_02 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_02 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_03 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_03 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_04 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_04 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_05 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_05 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_06 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_06 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_07 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_07 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_08 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_08 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_09 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_09 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_10 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_10 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_11 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_11 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_12 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_12 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2014_01 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2014_01 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_blob_2013_01 at 2019-01-10 02:48:01
-Migrated archive table archive_blob_2013_01 at 2019-01-10 02:48:01
-Processed ArchiveMigration at 2019-01-10 02:48:01
-', $this->applicationTester->getDisplay());
+' . $this->getExpectedArchiveMigrationOutput();
+ $this->assertEquals($expectedOutput, $this->applicationTester->getDisplay());
$this->assertEquals('0', $result);
}
@@ -156,11 +126,7 @@ public function testApi($api, $params)
FakeAccess::clearAccess(true);
$this->disableArchiving();
- if (in_array($api, [['Live.getLastVisitsDetails'], ['Actions.getPageUrls']]) && version_compare(Version::VERSION, '5.2.0-alpha', '<')) {
- $params['testSuffix'] = '5-2a';
- } elseif ($api === ['API.get'] && version_compare(Version::VERSION, '5.2.0-b6', '<')) {
- $params['testSuffix'] = '5-2b6';
- }
+ $params['testSuffix'] = $this->getTestSuffix($api);
$this->runApiTests($api, $params);
}
@@ -177,11 +143,7 @@ public function testApi_migrated($api, $params)
FakeAccess::clearAccess($superUser = true);
- if (in_array($api, [['Live.getLastVisitsDetails'], ['Actions.getPageUrls']]) && version_compare(Version::VERSION, '5.2.0-alpha', '<')) {
- $params['testSuffix'] = '5-2a';
- } elseif ($api === ['API.get'] && version_compare(Version::VERSION, '5.2.0-b6', '<')) {
- $params['testSuffix'] = '5-2b6';
- }
+ $params['testSuffix'] = $this->getTestSuffix($api);
try {
$this->runApiTests($api, $params);
} catch (\Exception $e) {
@@ -192,6 +154,69 @@ public function testApi_migrated($api, $params)
$this->setTargetDbPrefix('');
}
+ private function getTestSuffix($api)
+ {
+ if (
+ in_array($api, [['Live.getLastVisitsDetails'], ['Actions.getPageUrls'], ['SitesManager.getSiteFromId'], ['CustomDimensions.getConfiguredCustomDimensions']])
+ && version_compare(Version::VERSION, '5.2.0-alpha', '<')
+ ) {
+ return '5-2a';
+ }
+
+ if ($api === ['API.get'] && version_compare(Version::VERSION, '5.2.0-b6', '<')) {
+ return '5-2b6';
+ }
+
+ return '';
+ }
+
+ private function getExpectedArchiveMigrationOutput()
+ {
+ if (version_compare(Version::VERSION, '5.2.0-alpha', '<')) {
+ return 'Processing ArchiveMigration at 2019-01-10 02:48:01
+Found 14 archive tables at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_01 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_01 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_02 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_02 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_03 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_03 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_04 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_04 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_05 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_05 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_06 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_06 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_07 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_07 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_08 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_08 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_09 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_09 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_10 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_10 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_11 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_11 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_12 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_12 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2014_01 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2014_01 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_blob_2013_01 at 2019-01-10 02:48:01
+Migrated archive table archive_blob_2013_01 at 2019-01-10 02:48:01
+Processed ArchiveMigration at 2019-01-10 02:48:01
+';
+ }
+
+ return 'Processing ArchiveMigration at 2019-01-10 02:48:01
+Found 2 archive tables at 2019-01-10 02:48:01
+Starting to migrate archive table archive_blob_2013_01 at 2019-01-10 02:48:01
+Migrated archive table archive_blob_2013_01 at 2019-01-10 02:48:01
+Starting to migrate archive table archive_numeric_2013_01 at 2019-01-10 02:48:01
+Migrated archive table archive_numeric_2013_01 at 2019-01-10 02:48:01
+Processed ArchiveMigration at 2019-01-10 02:48:01
+';
+ }
+
private function setTargetDbPrefix($prefix)
{
$testEnv = self::$fixture->getTestEnvironment();
@@ -220,10 +245,12 @@ private function disableArchiving()
public function test_runMigration_CanBeExecutedMultipleTimesWithoutAnyIdProblems()
{
$result = $this->runCommand();
- $this->assertStringContainsString('Starting to migrate archive table archive_numeric_2013_01 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_01 at 2019-01-10 02:48:01
-Starting to migrate archive table archive_numeric_2013_02 at 2019-01-10 02:48:01
-Migrated archive table archive_numeric_2013_02 at 2019-01-10 02:48:01', $this->applicationTester->getDisplay());
+ $output = $this->applicationTester->getDisplay();
+ $this->assertTrue(
+ strpos($output, 'Migrated archive table archive_numeric_2013_01 at 2019-01-10 02:48:01') !== false
+ || strpos($output, 'Skipping table because it is a target table targetdb_archive_numeric_2013_01 and source prefix is: at 2019-01-10 02:48:01') !== false,
+ $output
+ );
$this->assertEquals('0', $result);
$result = $this->runCommand();
$this->assertEquals('0', $result);
diff --git a/tests/System/expected/test_5-2a__CustomDimensions.getConfiguredCustomDimensions.xml b/tests/System/expected/test_5-2a__CustomDimensions.getConfiguredCustomDimensions.xml
new file mode 100644
index 0000000..18098bd
--- /dev/null
+++ b/tests/System/expected/test_5-2a__CustomDimensions.getConfiguredCustomDimensions.xml
@@ -0,0 +1,36 @@
+
+
+
+ 1
+ 1
+ MyName1
+ 1
+ visit
+ 1
+
+
+ 1
+
+
+ 2
+ 1
+ MyName2
+ 1
+ action
+ 1
+
+
+ 1
+
+
+ 3
+ 1
+ MyName3
+ 2
+ action
+ 0
+
+
+ 1
+
+
diff --git a/tests/System/expected/test_5-2a__SitesManager.getSiteFromId.xml b/tests/System/expected/test_5-2a__SitesManager.getSiteFromId.xml
new file mode 100644
index 0000000..b2f37bb
--- /dev/null
+++ b/tests/System/expected/test_5-2a__SitesManager.getSiteFromId.xml
@@ -0,0 +1,26 @@
+
+
+
+ 1
+ MigrationSite
+ http://piwik.net
+ 2013-01-22 00:00:00
+ 1
+ 1
+
+
+ UTC
+ USD
+ 0
+
+
+
+
+
+ website
+ 0
+ superUserLogin
+ UTC
+ US Dollar
+
+
diff --git a/tests/System/expected/test___CustomDimensions.getConfiguredCustomDimensions.xml b/tests/System/expected/test___CustomDimensions.getConfiguredCustomDimensions.xml
index d4aa297..e665db8 100644
--- a/tests/System/expected/test___CustomDimensions.getConfiguredCustomDimensions.xml
+++ b/tests/System/expected/test___CustomDimensions.getConfiguredCustomDimensions.xml
@@ -4,6 +4,7 @@
1
1
MyName1
+
1
visit
1
@@ -15,6 +16,7 @@
2
1
MyName2
+
1
action
1
@@ -26,6 +28,7 @@
3
1
MyName3
+
2
action
0
diff --git a/tests/System/expected/test___SitesManager.getSiteFromId.xml b/tests/System/expected/test___SitesManager.getSiteFromId.xml
index 015ddde..c3f4de8 100644
--- a/tests/System/expected/test___SitesManager.getSiteFromId.xml
+++ b/tests/System/expected/test___SitesManager.getSiteFromId.xml
@@ -3,6 +3,7 @@
1
MigrationSite
+
http://piwik.net
2013-01-22 00:00:00
1