aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/UserMigration/TMigratorBasicVersionHandling.php
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-02-15 09:56:45 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-02-17 11:31:03 +0100
commit67fb1b92d6ad278377931e62f5f4af809b8cbe28 (patch)
treed58473e21c5d8bcf0ea8f551776fd87cbd15f5ba /lib/public/UserMigration/TMigratorBasicVersionHandling.php
parentb06a622a609ed9c980a14d16d8dd67c95df1a79e (diff)
downloadnextcloud-server-67fb1b92d6ad278377931e62f5f4af809b8cbe28.tar.gz
nextcloud-server-67fb1b92d6ad278377931e62f5f4af809b8cbe28.zip
Improve version handling for user_migration
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/public/UserMigration/TMigratorBasicVersionHandling.php')
-rw-r--r--lib/public/UserMigration/TMigratorBasicVersionHandling.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/public/UserMigration/TMigratorBasicVersionHandling.php b/lib/public/UserMigration/TMigratorBasicVersionHandling.php
index cb51e34c4b9..6b695ec45d9 100644
--- a/lib/public/UserMigration/TMigratorBasicVersionHandling.php
+++ b/lib/public/UserMigration/TMigratorBasicVersionHandling.php
@@ -32,6 +32,8 @@ namespace OCP\UserMigration;
trait TMigratorBasicVersionHandling {
protected int $version = 1;
+ protected bool $mandatory = false;
+
/**
* {@inheritDoc}
*/
@@ -42,7 +44,13 @@ trait TMigratorBasicVersionHandling {
/**
* {@inheritDoc}
*/
- public function canImport(int $version): bool {
+ public function canImport(
+ IImportSource $importSource,
+ ?int $version
+ ): bool {
+ if ($version === null) {
+ return !$this->mandatory;
+ }
return ($this->version >= $version);
}
}