mirror of
https://github.com/nextcloud/server.git
synced 2026-04-28 17:48:40 -04:00
Avoid passing both $importSource and $version while version comes from source
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
67fb1b92d6
commit
885b7904a2
3 changed files with 14 additions and 8 deletions
|
|
@ -70,6 +70,15 @@ interface IImportSource {
|
|||
*/
|
||||
public function getMigratorVersions(): array;
|
||||
|
||||
/**
|
||||
* @return ?int Version for this migrator from the export archive. Null means migrator missing.
|
||||
*
|
||||
* @param class-string<IMigrator> $migrator
|
||||
*
|
||||
* @since 24.0.0
|
||||
*/
|
||||
public function getMigratorVersion(string $migrator): ?int;
|
||||
|
||||
/**
|
||||
* Called after import is complete
|
||||
*
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ interface IMigrator {
|
|||
public function import(
|
||||
IUser $user,
|
||||
IImportSource $importSource,
|
||||
OutputInterface $output,
|
||||
?int $version
|
||||
OutputInterface $output
|
||||
): void;
|
||||
|
||||
/**
|
||||
|
|
@ -67,13 +66,11 @@ interface IMigrator {
|
|||
|
||||
/**
|
||||
* Checks whether it is able to import a version of the export format for this migrator
|
||||
*
|
||||
* @param ?int $version Version stored in the import source for this migrator. Null means this migrator was not listed.
|
||||
* Use $importSource->getMigratorVersion(static::class) to get the version from the archive
|
||||
*
|
||||
* @since 24.0.0
|
||||
*/
|
||||
public function canImport(
|
||||
IImportSource $importSource,
|
||||
?int $version
|
||||
IImportSource $importSource
|
||||
): bool;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ trait TMigratorBasicVersionHandling {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
public function canImport(
|
||||
IImportSource $importSource,
|
||||
?int $version
|
||||
IImportSource $importSource
|
||||
): bool {
|
||||
$version = $importSource->getMigratorVersion(static::class);
|
||||
if ($version === null) {
|
||||
return !$this->mandatory;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue