mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
refactor(encryption): Migrate app.php to Application.php
Signed-off-by: Louis Chemineau <louis@chmn.me>
This commit is contained in:
parent
beececf660
commit
39fd19f1d6
2 changed files with 30 additions and 27 deletions
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
namespace OCA\Encryption\AppInfo;
|
||||
|
||||
\OCP\Util::addscript('encryption', 'encryption');
|
||||
|
||||
$encryptionManager = \OC::$server->getEncryptionManager();
|
||||
$encryptionSystemReady = $encryptionManager->isReady();
|
||||
|
||||
/** @var Application $app */
|
||||
$app = \OC::$server->query(Application::class);
|
||||
if ($encryptionSystemReady) {
|
||||
$app->registerEncryptionModule($encryptionManager);
|
||||
$app->registerHooks(\OC::$server->getConfig());
|
||||
$app->setUp($encryptionManager);
|
||||
}
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue