Skip to content

Commit

Permalink
Migrate files to the PSR container
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Jul 16, 2020
1 parent da4f355 commit 1ba7586
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions apps/files/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,23 @@
use OCA\Files\Notification\Notifier;
use OCA\Files\Search\FilesSearchProvider;
use OCA\Files\Service\TagService;
use OCP\Activity\IManager as IActivityManager;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Collaboration\Resources\IProviderManager;
use OCP\IContainer;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IPreview;
use OCP\IRequest;
use OCP\IServerContainer;
use OCP\ITagManager;
use OCP\IUserSession;
use OCP\Notification\IManager;
use OCP\Share\IManager as IShareManager;
use OCP\Util;
use Psr\Container\ContainerInterface;

class Application extends App implements IBootstrap {
public const APP_ID = 'files';
Expand All @@ -68,33 +75,33 @@ public function register(IRegistrationContext $context): void {
/**
* Controllers
*/
$context->registerService('APIController', function (IContainer $c) {
$context->registerService('APIController', function (ContainerInterface $c) {
/** @var IServerContainer $server */
$server = $c->query(IServerContainer::class);
$server = $c->get(IServerContainer::class);

return new ApiController(
$c->query('AppName'),
$c->query('Request'),
$server->getUserSession(),
$c->query('TagService'),
$server->getPreviewManager(),
$server->getShareManager(),
$server->getConfig(),
$c->get('AppName'),
$c->get(IRequest::class),
$c->get(IUserSession::class),
$c->get(TagService::class),
$c->get(IPreview::class),
$c->get(IShareManager::class),
$c->get(IConfig::class),
$server->getUserFolder()
);
});

/**
* Services
*/
$context->registerService('TagService', function (IContainer $c) {
$context->registerService('TagService', function (ContainerInterface $c) {
/** @var IServerContainer $server */
$server = $c->query(IServerContainer::class);
$server = $c->get(IServerContainer::class);

return new TagService(
$server->getUserSession(),
$server->getActivityManager(),
$server->getTagManager()->load(self::APP_ID),
$c->get(IUserSession::class),
$c->get(IActivityManager::class),
$c->get(ITagManager::class)->load(self::APP_ID),
$server->getUserFolder(),
$server->getEventDispatcher()
);
Expand Down

0 comments on commit 1ba7586

Please sign in to comment.