aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/AppFramework
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2022-02-04 20:49:11 +0000
committerChristopher Ng <chrng8@gmail.com>2022-02-11 23:34:25 +0000
commite3244361bada8bc79384f49e127a9a310f05ae89 (patch)
tree7394101a88f4fd1865b419febe78da1d2dbef63f /lib/private/AppFramework
parent90d94c172e61b80de64275f064aac197f42bec8b (diff)
downloadnextcloud-server-e3244361bada8bc79384f49e127a9a310f05ae89.tar.gz
nextcloud-server-e3244361bada8bc79384f49e127a9a310f05ae89.zip
Allow registration of migrators
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'lib/private/AppFramework')
-rw-r--r--lib/private/AppFramework/Bootstrap/RegistrationContext.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php
index b40d3356d1a..7b4d24036e8 100644
--- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php
+++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php
@@ -52,6 +52,7 @@ use OCP\Notification\INotifier;
use OCP\Profile\ILinkAction;
use OCP\Search\IProvider;
use OCP\Support\CrashReport\IReporter;
+use OCP\UserMigration\IMigrator as IUserMigrator;
use Psr\Log\LoggerInterface;
use Throwable;
@@ -78,6 +79,9 @@ class RegistrationContext {
/** @var ServiceRegistration<IRoomBackend>[] */
private $calendarRoomBackendRegistrations = [];
+ /** @var ServiceRegistration<IUserMigrator>[] */
+ private $userMigrators = [];
+
/** @var ServiceFactoryRegistration[] */
private $services = [];
@@ -293,6 +297,13 @@ class RegistrationContext {
$class
);
}
+
+ public function registerUserMigrator(string $migratorClass): void {
+ $this->context->registerUserMigrator(
+ $this->appId,
+ $migratorClass
+ );
+ }
};
}
@@ -413,6 +424,13 @@ class RegistrationContext {
}
/**
+ * @psalm-param class-string<IUserMigrator> $migratorClass
+ */
+ public function registerUserMigrator(string $appId, string $migratorClass): void {
+ $this->userMigrators[] = new ServiceRegistration($appId, $migratorClass);
+ }
+
+ /**
* @param App[] $apps
*/
public function delegateCapabilityRegistrations(array $apps): void {
@@ -687,4 +705,11 @@ class RegistrationContext {
public function getCalendarRoomBackendRegistrations(): array {
return $this->calendarRoomBackendRegistrations;
}
+
+ /**
+ * @return ServiceRegistration<IUserMigrator>[]
+ */
+ public function getUserMigrators(): array {
+ return $this->userMigrators;
+ }
}