migrate to new Nextcloud app bootstrap

This commit is contained in:
korelstar 2020-08-27 07:53:52 +02:00
parent e8dc6fb93e
commit b6a3410dcf
6 changed files with 29 additions and 31 deletions

View File

@ -1,6 +0,0 @@
<?php
use OCA\Notes\Application;
$app = \OC::$server->query(Application::class);
$app->register();

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace OCA\Notes\AppInfo;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
class Application extends App implements IBootstrap {
public static $API_VERSIONS = [ '0.2', '1.1' ];
public function __construct(array $urlParams = []) {
parent::__construct('notes', $urlParams);
}
public function register(IRegistrationContext $context): void {
$context->registerCapability(Capabilities::class);
}
public function boot(IBootContext $context): void {
$context->getAppContainer()->get(NotesHooks::class)->register();
}
}

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace OCA\Notes;
namespace OCA\Notes\AppInfo;
use OCP\Capabilities\ICapability;
use OCP\App\IAppManager;

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace OCA\Notes;
namespace OCA\Notes\AppInfo;
use OCA\Notes\Service\MetaService;
@ -27,7 +27,6 @@ class NotesHooks {
}
public function register() : void {
$this->logger->error('Register NotesHooks');
$this->listenTo(
$this->rootFolder,
'\OC\Files',

View File

@ -1,21 +0,0 @@
<?php
declare(strict_types=1);
namespace OCA\Notes;
use OCP\AppFramework\App;
class Application extends App {
public static $API_VERSIONS = [ '0.2', '1.1' ];
public function __construct(array $urlParams = []) {
parent::__construct('notes', $urlParams);
}
public function register() : void {
$container = $this->getContainer();
$container->registerCapability(Capabilities::class);
$container->query(NotesHooks::class)->register();
}
}

View File

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace OCA\Notes\Controller;
use OCA\Notes\Application;
use OCA\Notes\AppInfo\Application;
use OCA\Notes\Service\Util;
use OCP\AppFramework\Http;