diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-07-16 17:08:03 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-07-21 20:43:18 +0200 |
commit | 91e7f12088cb87ffef5660429ece404364167978 (patch) | |
tree | baf44ebc7b240bd49eb0f6bf615cbb1ed99d13db /apps/comments/lib | |
parent | e029055e766298c5852eedabf06ff42b06a50198 (diff) | |
download | nextcloud-server-91e7f12088cb87ffef5660429ece404364167978.tar.gz nextcloud-server-91e7f12088cb87ffef5660429ece404364167978.zip |
Adjust apps' code to use the ContainerInterface
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/comments/lib')
-rw-r--r-- | apps/comments/lib/AppInfo/Application.php | 11 | ||||
-rw-r--r-- | apps/comments/lib/JSSettingsHelper.php | 8 |
2 files changed, 11 insertions, 8 deletions
diff --git a/apps/comments/lib/AppInfo/Application.php b/apps/comments/lib/AppInfo/Application.php index fafac0c6040..247ba034107 100644 --- a/apps/comments/lib/AppInfo/Application.php +++ b/apps/comments/lib/AppInfo/Application.php @@ -27,6 +27,7 @@ namespace OCA\Comments\AppInfo; +use Closure; use OCA\Comments\Capabilities; use OCA\Comments\Controller\Notifications; use OCA\Comments\EventHandler; @@ -44,6 +45,8 @@ use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\Comments\CommentsEntityEvent; +use OCP\IConfig; +use OCP\ISearch; use OCP\IServerContainer; use OCP\Util; @@ -75,13 +78,13 @@ class Application extends App implements IBootstrap { } public function boot(IBootContext $context): void { - $this->registerNotifier($context->getServerContainer()); - $this->registerCommentsEventHandler($context->getServerContainer()); + $context->injectFn(Closure::fromCallable([$this, 'registerNotifier'])); + $context->injectFn(Closure::fromCallable([$this, 'registerCommentsEventHandler'])); - $jsSettingsHelper = new JSSettingsHelper($context->getServerContainer()); + $jsSettingsHelper = new JSSettingsHelper($context->getAppContainer()->get(IConfig::class)); Util::connectHook('\OCP\Config', 'js', $jsSettingsHelper, 'extend'); - $context->getServerContainer()->getSearch()->registerProvider(LegacyProvider::class, ['apps' => ['files']]); + $context->getServerContainer()->get(ISearch::class)->registerProvider(LegacyProvider::class, ['apps' => ['files']]); } protected function registerNotifier(IServerContainer $container) { diff --git a/apps/comments/lib/JSSettingsHelper.php b/apps/comments/lib/JSSettingsHelper.php index 4c54bb07c1c..93578e06295 100644 --- a/apps/comments/lib/JSSettingsHelper.php +++ b/apps/comments/lib/JSSettingsHelper.php @@ -23,20 +23,20 @@ namespace OCA\Comments; -use OCP\IServerContainer; +use OCP\IConfig; class JSSettingsHelper { - /** @var IServerContainer */ + /** @var IConfig */ private $c; - public function __construct(IServerContainer $c) { + public function __construct(IConfig $c) { $this->c = $c; } public function extend(array $settings) { $appConfig = json_decode($settings['array']['oc_appconfig'], true); - $value = (int)$this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); + $value = (int)$this->c->getAppValue('comments', 'maxAutoCompleteResults', 10); $appConfig['comments']['maxAutoCompleteResults'] = $value; $settings['array']['oc_appconfig'] = json_encode($appConfig); |