diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-04-11 10:53:51 +0200 |
---|---|---|
committer | Côme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com> | 2022-04-11 13:59:27 +0000 |
commit | dda51d49d7e108d149c042964f9c2e3efef14110 (patch) | |
tree | 0ddcd5bfa6d62cea44f4c086db5b4886077c31e9 | |
parent | 682468ef5cda2d3aefed9cd5db80021da22bb593 (diff) | |
download | nextcloud-server-dda51d49d7e108d149c042964f9c2e3efef14110.tar.gz nextcloud-server-dda51d49d7e108d149c042964f9c2e3efef14110.zip |
Use Migrators id instead of class names
This will help with UI and means migrators can move in namespaces
without changing export format.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
7 files changed, 7 insertions, 7 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/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; } |