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>
pull/31925/head
Côme Chilliet 3 years ago committed by Côme Chilliet (Rebase PR Action)
parent 682468ef5c
commit dda51d49d7
  1. 2
      apps/dav/lib/UserMigration/CalendarMigrator.php
  2. 2
      apps/dav/lib/UserMigration/ContactsMigrator.php
  3. 2
      apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
  4. 2
      apps/settings/lib/UserMigration/AccountMigrator.php
  5. 2
      lib/public/UserMigration/IImportSource.php
  6. 2
      lib/public/UserMigration/IMigrator.php
  7. 2
      lib/public/UserMigration/TMigratorBasicVersionHandling.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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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
*/

@ -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
*/

@ -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;
}

Loading…
Cancel
Save