diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2022-04-11 16:57:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 16:57:35 +0200 |
commit | 2c0471176c6c562d43b7c871fba466574da3e630 (patch) | |
tree | 3bc8b1ba977ab718fae204040eb0618b6be57aa3 | |
parent | 682468ef5cda2d3aefed9cd5db80021da22bb593 (diff) | |
parent | eed6330b92cc83541206a0c29980245ebbf3375a (diff) | |
download | nextcloud-server-2c0471176c6c562d43b7c871fba466574da3e630.tar.gz nextcloud-server-2c0471176c6c562d43b7c871fba466574da3e630.zip |
Merge pull request #31925 from nextcloud/fix/user_migration-use-id-for-migrators
Use Migrators id instead of class names
8 files changed, 8 insertions, 8 deletions
diff --git a/apps/dav/lib/UserMigration/CalendarMigrator.php b/apps/dav/lib/UserMigration/CalendarMigrator.php index f560b4853b2..37a8de36d8d 100644 --- a/apps/dav/lib/UserMigration/CalendarMigrator.php +++ b/apps/dav/lib/UserMigration/CalendarMigrator.php @@ -414,7 +414,7 @@ class CalendarMigrator implements IMigrator { * @throws CalendarMigratorException */ public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void { - if ($importSource->getMigratorVersion(static::class) === null) { + if ($importSource->getMigratorVersion($this->getId()) === null) { $output->writeln('No version for ' . static::class . ', skipping import…'); return; } diff --git a/apps/dav/lib/UserMigration/ContactsMigrator.php b/apps/dav/lib/UserMigration/ContactsMigrator.php index cfdc20bfdf3..99eea2700a5 100644 --- a/apps/dav/lib/UserMigration/ContactsMigrator.php +++ b/apps/dav/lib/UserMigration/ContactsMigrator.php @@ -306,7 +306,7 @@ class ContactsMigrator implements IMigrator { * @throws ContactsMigratorException */ public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void { - if ($importSource->getMigratorVersion(static::class) === null) { + if ($importSource->getMigratorVersion($this->getId()) === null) { $output->writeln('No version for ' . static::class . ', skipping import…'); return; } diff --git a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php index c7832ec5bc8..95ed25088b1 100644 --- a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php +++ b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php @@ -93,7 +93,7 @@ class TrashbinMigrator implements IMigrator { * {@inheritDoc} */ public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void { - if ($importSource->getMigratorVersion(static::class) === null) { + if ($importSource->getMigratorVersion($this->getId()) === null) { $output->writeln('No version for ' . static::class . ', skipping import…'); return; } diff --git a/apps/settings/lib/UserMigration/AccountMigrator.php b/apps/settings/lib/UserMigration/AccountMigrator.php index a39c510813f..e4218d72a76 100644 --- a/apps/settings/lib/UserMigration/AccountMigrator.php +++ b/apps/settings/lib/UserMigration/AccountMigrator.php @@ -95,7 +95,7 @@ class AccountMigrator implements IMigrator { * {@inheritDoc} */ public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void { - if ($importSource->getMigratorVersion(static::class) === null) { + if ($importSource->getMigratorVersion($this->getId()) === null) { $output->writeln('No version for ' . static::class . ', skipping import…'); return; } diff --git a/apps/settings/tests/UserMigration/AccountMigratorTest.php b/apps/settings/tests/UserMigration/AccountMigratorTest.php index c668bb9e6af..b7826c20e60 100644 --- a/apps/settings/tests/UserMigration/AccountMigratorTest.php +++ b/apps/settings/tests/UserMigration/AccountMigratorTest.php @@ -98,7 +98,7 @@ class AccountMigratorTest extends TestCase { $this->importSource ->expects($this->once()) ->method('getMigratorVersion') - ->with(AccountMigrator::class) + ->with($this->migrator->getId()) ->willReturn(1); $this->importSource diff --git a/lib/public/UserMigration/IImportSource.php b/lib/public/UserMigration/IImportSource.php index d34f2752549..3816afdd033 100644 --- a/lib/public/UserMigration/IImportSource.php +++ b/lib/public/UserMigration/IImportSource.php @@ -91,7 +91,7 @@ interface IImportSource { /** * @return ?int Version for this migrator from the export archive. Null means migrator missing. * - * @param class-string<IMigrator> $migrator + * @param string $migrator Migrator id (as returned by IMigrator::getId) * * @since 24.0.0 */ diff --git a/lib/public/UserMigration/IMigrator.php b/lib/public/UserMigration/IMigrator.php index 7c89e041f34..d02e5df0683 100644 --- a/lib/public/UserMigration/IMigrator.php +++ b/lib/public/UserMigration/IMigrator.php @@ -89,7 +89,7 @@ interface IMigrator { /** * Checks whether it is able to import a version of the export format for this migrator - * Use $importSource->getMigratorVersion(static::class) to get the version from the archive + * Use $importSource->getMigratorVersion($this->getId()) to get the version from the archive * * @since 24.0.0 */ diff --git a/lib/public/UserMigration/TMigratorBasicVersionHandling.php b/lib/public/UserMigration/TMigratorBasicVersionHandling.php index 20a30a24307..9010d14a173 100644 --- a/lib/public/UserMigration/TMigratorBasicVersionHandling.php +++ b/lib/public/UserMigration/TMigratorBasicVersionHandling.php @@ -50,7 +50,7 @@ trait TMigratorBasicVersionHandling { public function canImport( IImportSource $importSource ): bool { - $version = $importSource->getMigratorVersion(static::class); + $version = $importSource->getMigratorVersion($this->getId()); if ($version === null) { return !$this->mandatory; } |