Skip to content

Commit 2c04711

Browse files
authored
Merge pull request #31925 from nextcloud/fix/user_migration-use-id-for-migrators
Use Migrators id instead of class names
2 parents 682468e + eed6330 commit 2c04711

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

apps/dav/lib/UserMigration/CalendarMigrator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ function (array $componentNames, VObjectComponent $component) {
414414
* @throws CalendarMigratorException
415415
*/
416416
public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void {
417-
if ($importSource->getMigratorVersion(static::class) === null) {
417+
if ($importSource->getMigratorVersion($this->getId()) === null) {
418418
$output->writeln('No version for ' . static::class . ', skipping import…');
419419
return;
420420
}

apps/dav/lib/UserMigration/ContactsMigrator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ private function getAddressBookImports(array $importFiles): array {
306306
* @throws ContactsMigratorException
307307
*/
308308
public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void {
309-
if ($importSource->getMigratorVersion(static::class) === null) {
309+
if ($importSource->getMigratorVersion($this->getId()) === null) {
310310
$output->writeln('No version for ' . static::class . ', skipping import…');
311311
return;
312312
}

apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function export(IUser $user, IExportDestination $exportDestination, Outpu
9393
* {@inheritDoc}
9494
*/
9595
public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void {
96-
if ($importSource->getMigratorVersion(static::class) === null) {
96+
if ($importSource->getMigratorVersion($this->getId()) === null) {
9797
$output->writeln('No version for ' . static::class . ', skipping import…');
9898
return;
9999
}

apps/settings/lib/UserMigration/AccountMigrator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function export(IUser $user, IExportDestination $exportDestination, Outpu
9595
* {@inheritDoc}
9696
*/
9797
public function import(IUser $user, IImportSource $importSource, OutputInterface $output): void {
98-
if ($importSource->getMigratorVersion(static::class) === null) {
98+
if ($importSource->getMigratorVersion($this->getId()) === null) {
9999
$output->writeln('No version for ' . static::class . ', skipping import…');
100100
return;
101101
}

apps/settings/tests/UserMigration/AccountMigratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testImportExportAccount(string $userId, array $importData): void
9898
$this->importSource
9999
->expects($this->once())
100100
->method('getMigratorVersion')
101-
->with(AccountMigrator::class)
101+
->with($this->migrator->getId())
102102
->willReturn(1);
103103

104104
$this->importSource

lib/public/UserMigration/IImportSource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getMigratorVersions(): array;
9191
/**
9292
* @return ?int Version for this migrator from the export archive. Null means migrator missing.
9393
*
94-
* @param class-string<IMigrator> $migrator
94+
* @param string $migrator Migrator id (as returned by IMigrator::getId)
9595
*
9696
* @since 24.0.0
9797
*/

lib/public/UserMigration/IMigrator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function getVersion(): int;
8989

9090
/**
9191
* Checks whether it is able to import a version of the export format for this migrator
92-
* Use $importSource->getMigratorVersion(static::class) to get the version from the archive
92+
* Use $importSource->getMigratorVersion($this->getId()) to get the version from the archive
9393
*
9494
* @since 24.0.0
9595
*/

lib/public/UserMigration/TMigratorBasicVersionHandling.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getVersion(): int {
5050
public function canImport(
5151
IImportSource $importSource
5252
): bool {
53-
$version = $importSource->getMigratorVersion(static::class);
53+
$version = $importSource->getMigratorVersion($this->getId());
5454
if ($version === null) {
5555
return !$this->mandatory;
5656
}

0 commit comments

Comments
 (0)