Skip to content

Commit 0166265

Browse files
authored
Merge pull request #46136 from nextcloud/artonge/debt/encryption_application_boot
debt(encryption): Migrate app.php to Application.php
2 parents beececf + 39fd19f commit 0166265

2 files changed

Lines changed: 30 additions & 27 deletions

File tree

apps/encryption/appinfo/app.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

apps/encryption/lib/AppInfo/Application.php

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,40 @@
1818
use OCA\Encryption\Session;
1919
use OCA\Encryption\Users\Setup;
2020
use OCA\Encryption\Util;
21+
use OCP\AppFramework\App;
22+
use OCP\AppFramework\Bootstrap\IBootContext;
23+
use OCP\AppFramework\Bootstrap\IBootstrap;
24+
use OCP\AppFramework\Bootstrap\IRegistrationContext;
2125
use OCP\Encryption\IManager;
2226
use OCP\IConfig;
2327
use Psr\Log\LoggerInterface;
2428

25-
class Application extends \OCP\AppFramework\App {
26-
/**
27-
* @param array $urlParams
28-
*/
29-
public function __construct($urlParams = []) {
30-
parent::__construct('encryption', $urlParams);
29+
class Application extends App implements IBootstrap {
30+
public const APP_ID = 'encryption';
31+
32+
public function __construct(array $urlParams = []) {
33+
parent::__construct(self::APP_ID, $urlParams);
34+
}
35+
36+
public function register(IRegistrationContext $context): void {
37+
}
38+
39+
public function boot(IBootContext $context): void {
40+
\OCP\Util::addScript(self::APP_ID, 'encryption');
41+
42+
$context->injectFn(function (IManager $encryptionManager) use ($context) {
43+
if (!($encryptionManager instanceof \OC\Encryption\Manager)) {
44+
return;
45+
}
46+
47+
if (!$encryptionManager->isReady()) {
48+
return;
49+
}
50+
51+
$context->injectFn($this->registerEncryptionModule(...));
52+
$context->injectFn($this->registerHooks(...));
53+
$context->injectFn($this->setUp(...));
54+
});
3155
}
3256

3357
public function setUp(IManager $encryptionManager) {

0 commit comments

Comments
 (0)