0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-01-15 23:59:16 +00:00
nextcloud_server/lib/public/UserMigration/TMigratorBasicVersionHandling.php
provokateurin 9836e9b164
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +02:00

42 lines
793 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\UserMigration;
/**
* Basic version handling: we can import older versions but not newer ones
* @since 24.0.0
*/
trait TMigratorBasicVersionHandling {
protected int $version = 1;
protected bool $mandatory = false;
/**
* {@inheritDoc}
* @since 24.0.0
*/
public function getVersion(): int {
return $this->version;
}
/**
* {@inheritDoc}
* @since 24.0.0
*/
public function canImport(
IImportSource $importSource,
): bool {
$version = $importSource->getMigratorVersion($this->getId());
if ($version === null) {
return !$this->mandatory;
}
return ($this->version >= $version);
}
}