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>
This commit is contained in:
Côme Chilliet 2022-04-11 10:53:51 +02:00 committed by Côme Chilliet (Rebase PR Action)
parent 682468ef5c
commit dda51d49d7
7 changed files with 7 additions and 7 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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