2014-08-09 12:39:12 +04:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 17:49:16 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
2019-12-19 15:16:31 +03:00
|
|
|
* @author Daniel Kesselberg <mail@danielkesselberg.de>
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Joas Schilling <coding@schilljs.com>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
|
|
|
|
* @author Julius Härtl <jus@bitgrid.net>
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
2016-07-21 17:49:16 +03:00
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Tobias Kaminsky <tobias@kaminsky.me>
|
|
|
|
* @author Vincent Petry <pvince81@owncloud.com>
|
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2015-03-26 13:44:34 +03:00
|
|
|
*
|
2014-08-09 12:39:12 +04:00
|
|
|
*/
|
2019-11-22 22:52:10 +03:00
|
|
|
|
2015-03-21 22:12:55 +03:00
|
|
|
namespace OCA\Files\AppInfo;
|
2014-08-09 12:39:12 +04:00
|
|
|
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCA\Files\Capabilities;
|
2019-02-22 14:21:08 +03:00
|
|
|
use OCA\Files\Collaboration\Resources\Listener;
|
2019-01-24 13:43:18 +03:00
|
|
|
use OCA\Files\Collaboration\Resources\ResourceProvider;
|
2014-08-09 12:39:12 +04:00
|
|
|
use OCA\Files\Controller\ApiController;
|
2019-08-02 21:08:54 +03:00
|
|
|
use OCA\Files\Event\LoadAdditionalScriptsEvent;
|
2019-12-03 20:20:46 +03:00
|
|
|
use OCA\Files\Event\LoadSidebar;
|
2019-08-02 21:08:54 +03:00
|
|
|
use OCA\Files\Listener\LegacyLoadAdditionalScriptsAdapter;
|
2019-12-03 20:20:46 +03:00
|
|
|
use OCA\Files\Listener\LoadSidebarListener;
|
2019-10-29 14:22:15 +03:00
|
|
|
use OCA\Files\Notification\Notifier;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCA\Files\Service\TagService;
|
2014-08-09 12:39:12 +04:00
|
|
|
use OCP\AppFramework\App;
|
2019-09-29 21:57:00 +03:00
|
|
|
use OCP\Collaboration\Resources\IProviderManager;
|
2019-08-02 21:08:54 +03:00
|
|
|
use OCP\EventDispatcher\IEventDispatcher;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCP\IContainer;
|
2014-08-09 12:39:12 +04:00
|
|
|
|
|
|
|
class Application extends App {
|
2019-10-29 14:22:15 +03:00
|
|
|
|
|
|
|
public const APP_ID = 'files';
|
|
|
|
|
2020-03-26 11:30:18 +03:00
|
|
|
public function __construct(array $urlParams=[]) {
|
2019-10-29 14:22:15 +03:00
|
|
|
parent::__construct(self::APP_ID, $urlParams);
|
2014-08-09 12:39:12 +04:00
|
|
|
$container = $this->getContainer();
|
2015-03-16 14:42:40 +03:00
|
|
|
$server = $container->getServer();
|
2014-08-09 12:39:12 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Controllers
|
|
|
|
*/
|
2015-03-16 14:42:40 +03:00
|
|
|
$container->registerService('APIController', function (IContainer $c) use ($server) {
|
2014-08-09 12:39:12 +04:00
|
|
|
return new ApiController(
|
|
|
|
$c->query('AppName'),
|
2014-11-18 20:53:45 +03:00
|
|
|
$c->query('Request'),
|
2016-03-16 13:03:26 +03:00
|
|
|
$server->getUserSession(),
|
2015-03-16 14:42:40 +03:00
|
|
|
$c->query('TagService'),
|
2016-03-16 13:03:26 +03:00
|
|
|
$server->getPreviewManager(),
|
2016-04-12 12:08:26 +03:00
|
|
|
$server->getShareManager(),
|
2016-07-22 15:48:51 +03:00
|
|
|
$server->getConfig(),
|
|
|
|
$server->getUserFolder()
|
2014-11-18 20:53:45 +03:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Services
|
|
|
|
*/
|
2018-01-10 13:20:21 +03:00
|
|
|
$container->registerService('TagService', function(IContainer $c) use ($server) {
|
2014-11-18 20:53:45 +03:00
|
|
|
$homeFolder = $c->query('ServerContainer')->getUserFolder();
|
|
|
|
return new TagService(
|
|
|
|
$c->query('ServerContainer')->getUserSession(),
|
2016-12-04 14:14:10 +03:00
|
|
|
$c->query('ServerContainer')->getActivityManager(),
|
2019-10-29 14:22:15 +03:00
|
|
|
$c->query('ServerContainer')->getTagManager()->load(self::APP_ID),
|
2018-01-10 13:20:21 +03:00
|
|
|
$homeFolder,
|
|
|
|
$server->getEventDispatcher()
|
2014-11-18 20:53:45 +03:00
|
|
|
);
|
|
|
|
});
|
2015-03-21 22:12:55 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Register capabilities
|
|
|
|
*/
|
2018-01-26 01:16:13 +03:00
|
|
|
$container->registerCapability(Capabilities::class);
|
2019-01-24 13:43:18 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Register Collaboration ResourceProvider
|
|
|
|
*/
|
2019-09-29 21:57:00 +03:00
|
|
|
/** @var IProviderManager $providerManager */
|
|
|
|
$providerManager = $container->query(IProviderManager::class);
|
|
|
|
$providerManager->registerResourceProvider(ResourceProvider::class);
|
2019-02-22 14:21:08 +03:00
|
|
|
Listener::register($server->getEventDispatcher());
|
2019-08-02 21:08:54 +03:00
|
|
|
|
|
|
|
/** @var IEventDispatcher $dispatcher */
|
|
|
|
$dispatcher = $container->query(IEventDispatcher::class);
|
|
|
|
$dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class);
|
2019-12-03 20:20:46 +03:00
|
|
|
$dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class);
|
2019-10-29 14:22:15 +03:00
|
|
|
|
|
|
|
/** @var \OCP\Notification\IManager $notifications */
|
|
|
|
$notifications = $container->query(\OCP\Notification\IManager::class);
|
|
|
|
$notifications->registerNotifierService(Notifier::class);
|
2014-08-09 12:39:12 +04:00
|
|
|
}
|
|
|
|
}
|