diff options
author | Louis Chemineau <louis@chmn.me> | 2024-06-27 11:33:21 +0200 |
---|---|---|
committer | Louis <louis@chmn.me> | 2024-07-01 13:45:09 +0200 |
commit | 39fd19f1d68037edce9080ac3af11bb9ff9320c5 (patch) | |
tree | ed9929992357ce04456989850b293c495bb41be4 /apps/encryption/lib | |
parent | beececf66068f57c416225efcde9b44ce5c2e835 (diff) | |
download | nextcloud-server-39fd19f1d68037edce9080ac3af11bb9ff9320c5.tar.gz nextcloud-server-39fd19f1d68037edce9080ac3af11bb9ff9320c5.zip |
refactor(encryption): Migrate app.php to Application.php
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r-- | apps/encryption/lib/AppInfo/Application.php | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/apps/encryption/lib/AppInfo/Application.php b/apps/encryption/lib/AppInfo/Application.php index fa765de4248..d3f7eb44145 100644 --- a/apps/encryption/lib/AppInfo/Application.php +++ b/apps/encryption/lib/AppInfo/Application.php @@ -18,16 +18,40 @@ use OCA\Encryption\Recovery; use OCA\Encryption\Session; use OCA\Encryption\Users\Setup; use OCA\Encryption\Util; +use OCP\AppFramework\App; +use OCP\AppFramework\Bootstrap\IBootContext; +use OCP\AppFramework\Bootstrap\IBootstrap; +use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\Encryption\IManager; use OCP\IConfig; use Psr\Log\LoggerInterface; -class Application extends \OCP\AppFramework\App { - /** - * @param array $urlParams - */ - public function __construct($urlParams = []) { - parent::__construct('encryption', $urlParams); +class Application extends App implements IBootstrap { + public const APP_ID = 'encryption'; + + public function __construct(array $urlParams = []) { + parent::__construct(self::APP_ID, $urlParams); + } + + public function register(IRegistrationContext $context): void { + } + + public function boot(IBootContext $context): void { + \OCP\Util::addScript(self::APP_ID, 'encryption'); + + $context->injectFn(function (IManager $encryptionManager) use ($context) { + if (!($encryptionManager instanceof \OC\Encryption\Manager)) { + return; + } + + if (!$encryptionManager->isReady()) { + return; + } + + $context->injectFn($this->registerEncryptionModule(...)); + $context->injectFn($this->registerHooks(...)); + $context->injectFn($this->setUp(...)); + }); } public function setUp(IManager $encryptionManager) { |