nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php

589 lines
17 KiB
PHP
Raw Normal View History

2013-08-17 13:16:48 +04:00
<?php
/**
2016-07-21 18:07:57 +03:00
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
2015-03-26 13:44:34 +03:00
* @author Bernhard Posselt <dev@bernhard-posselt.com>
2016-05-26 20:56:05 +03:00
* @author Christoph Wurst <christoph@owncloud.com>
2016-07-21 18:07:57 +03:00
* @author Joas Schilling <coding@schilljs.com>
2015-03-26 13:44:34 +03:00
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
2016-05-26 20:56:05 +03:00
* @author Lukas Reschke <lukas@statuscode.ch>
2015-03-26 13:44:34 +03:00
* @author Morris Jobke <hey@morrisjobke.de>
2016-01-12 17:02:16 +03:00
* @author Robin McCorkell <robin@mccorkell.me.uk>
2016-07-21 18:07:57 +03:00
* @author Roeland Jago Douma <roeland@famdouma.nl>
2015-03-26 13:44:34 +03:00
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Thomas Tanghus <thomas@tanghus.net>
2013-08-17 13:16:48 +04:00
*
2015-03-26 13:44:34 +03:00
* @license AGPL-3.0
2013-08-17 13:16:48 +04:00
*
2015-03-26 13:44:34 +03:00
* 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.
2013-08-17 13:16:48 +04:00
*
2015-03-26 13:44:34 +03:00
* This program is distributed in the hope that it will be useful,
2013-08-17 13:16:48 +04:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
2015-03-26 13:44:34 +03:00
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2013-08-17 13:16:48 +04:00
*
2015-03-26 13:44:34 +03:00
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
2013-08-17 13:16:48 +04:00
*
*/
2013-08-17 13:16:48 +04:00
namespace OC\AppFramework\DependencyInjection;
use OC;
2016-05-11 12:23:25 +03:00
use OC\AppFramework\Core\API;
use OC\AppFramework\Http;
2013-08-17 13:16:48 +04:00
use OC\AppFramework\Http\Dispatcher;
use OC\AppFramework\Http\Output;
2013-08-17 13:16:48 +04:00
use OC\AppFramework\Middleware\MiddlewareDispatcher;
use OC\AppFramework\Middleware\Security\CORSMiddleware;
use OC\AppFramework\Middleware\OCSMiddleware;
2016-05-11 12:23:25 +03:00
use OC\AppFramework\Middleware\Security\SecurityMiddleware;
use OC\AppFramework\Middleware\SessionMiddleware;
2013-08-20 19:21:14 +04:00
use OC\AppFramework\Utility\SimpleContainer;
2016-05-11 12:23:25 +03:00
use OC\Core\Middleware\TwoFactorMiddleware;
use OC\RichObjectStrings\Validator;
use OC\ServerContainer;
2013-08-21 03:02:15 +04:00
use OCP\AppFramework\IApi;
use OCP\AppFramework\IAppContainer;
use OCP\AppFramework\QueryException;
use OCP\Federation\ICloudIdManager;
use OCP\Files\IAppData;
use OCP\Files\Mount\IMountManager;
use OCP\IServerContainer;
use OCP\RichObjectStrings\IValidator;
use OCP\Util;
2013-08-17 13:16:48 +04:00
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
class DIContainer extends SimpleContainer implements IAppContainer {
2013-08-17 13:16:48 +04:00
2013-09-27 19:15:26 +04:00
/**
* @var array
*/
2013-09-28 22:40:25 +04:00
private $middleWares = array();
2013-08-17 13:16:48 +04:00
/** @var ServerContainer */
private $server;
2013-08-17 13:16:48 +04:00
/**
* Put your class dependencies in here
* @param string $appName the name of the app
* @param array $urlParams
* @param ServerContainer $server
2013-08-17 13:16:48 +04:00
*/
public function __construct($appName, $urlParams = array(), ServerContainer $server = null){
parent::__construct();
2013-08-17 13:16:48 +04:00
$this['AppName'] = $appName;
$this['urlParams'] = $urlParams;
2013-08-17 13:16:48 +04:00
/** @var \OC\ServerContainer $server */
if ($server === null) {
$server = \OC::$server;
}
$this->server = $server;
$this->server->registerAppContainer($appName, $this);
// aliases
$this->registerAlias('appName', 'AppName');
$this->registerAlias('webRoot', 'WebRoot');
$this->registerAlias('userId', 'UserId');
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
/**
* Core services
*/
$this->registerService('OCP\\App\\IAppManager', function($c) {
return $this->getServer()->getAppManager();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\AppFramework\\Http\\IOutput', function($c){
return new Output($this->getServer()->getWebRoot());
});
$this->registerService(\OCP\Authentication\LoginCredentials\IStore::class, function() {
return $this->getServer()->query(\OCP\Authentication\LoginCredentials\IStore::class);
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\IAvatarManager', function($c) {
return $this->getServer()->getAvatarManager();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\Activity\\IManager', function($c) {
return $this->getServer()->getActivityManager();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService(\OCP\Activity\IEventMerger::class, function($c) {
return $this->getServer()->query(\OCP\Activity\IEventMerger::class);
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\ICache', function($c) {
return $this->getServer()->getCache();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\ICacheFactory', function($c) {
return $this->getServer()->getMemCacheFactory();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OC\\CapabilitiesManager', function($c) {
return $this->getServer()->getCapabilitiesManager();
});
2016-02-05 13:20:16 +03:00
$this->registerService('OCP\Comments\ICommentsManager', function($c) {
return $this->getServer()->getCommentsManager();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\Contacts\\IManager', function($c) {
return $this->getServer()->getContactsManager();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\IDateTimeZone', function($c) {
return $this->getServer()->getDateTimeZone();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\IDateTimeFormatter', function($c) {
return $this->getServer()->getDateTimeFormatter();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\IDBConnection', function($c) {
return $this->getServer()->getDatabaseConnection();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\Diagnostics\\IEventLogger', function($c) {
return $this->getServer()->getEventLogger();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\Diagnostics\\IQueryLogger', function($c) {
return $this->getServer()->getQueryLogger();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService(ICloudIdManager::class, function($c) {
return $this->getServer()->getCloudIdManager();
});
$this->registerService('OCP\\Files\\IMimeTypeDetector', function($c) {
return $this->getServer()->getMimeTypeDetector();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\Files\\Config\\IMountProviderCollection', function($c) {
return $this->getServer()->getMountProviderCollection();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\Files\\Config\\IUserMountCache', function($c) {
return $this->getServer()->getUserMountCache();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\Files\\IRootFolder', function($c) {
return $this->getServer()->getRootFolder();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\Files\\Folder', function() {
return $this->getServer()->getUserFolder();
});
2016-05-01 16:08:56 +03:00
$this->registerService('OCP\\Http\\Client\\IClientService', function($c) {
return $this->getServer()->getHTTPClientService();
});
$this->registerService(IAppData::class, function (SimpleContainer $c) {
return $this->getServer()->getAppDataDir($c->query('AppName'));
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\IGroupManager', function($c) {
return $this->getServer()->getGroupManager();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\Http\\Client\\IClientService', function() {
return $this->getServer()->getHTTPClientService();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\IL10N', function($c) {
return $this->getServer()->getL10N($c->query('AppName'));
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\L10N\\IFactory', function($c) {
return $this->getServer()->getL10NFactory();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\ILogger', function($c) {
return $this->getServer()->getLogger();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\BackgroundJob\\IJobList', function($c) {
return $this->getServer()->getJobList();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerAlias('OCP\\AppFramework\\Utility\\IControllerMethodReflector', 'OC\AppFramework\Utility\ControllerMethodReflector');
$this->registerAlias('ControllerMethodReflector', 'OCP\\AppFramework\\Utility\\IControllerMethodReflector');
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\Files\\IMimeTypeDetector', function($c) {
return $this->getServer()->getMimeTypeDetector();
});
$this->registerService('OCP\\Mail\\IMailer', function() {
return $this->getServer()->getMailer();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\INavigationManager', function($c) {
return $this->getServer()->getNavigationManager();
2013-08-17 13:16:48 +04:00
});
$this->registerService('OCP\\Notification\IManager', function($c) {
return $this->getServer()->getNotificationManager();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\IPreview', function($c) {
return $this->getServer()->getPreviewManager();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\IRequest', function () {
return $this->getServer()->getRequest();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerAlias('Request', 'OCP\\IRequest');
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\ITagManager', function($c) {
return $this->getServer()->getTagManager();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\ITempManager', function($c) {
return $this->getServer()->getTempManager();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerAlias('OCP\\AppFramework\\Utility\\ITimeFactory', 'OC\AppFramework\Utility\TimeFactory');
$this->registerAlias('TimeFactory', 'OCP\\AppFramework\\Utility\\ITimeFactory');
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\Route\\IRouter', function($c) {
return $this->getServer()->getRouter();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\ISearch', function($c) {
return $this->getServer()->getSearch();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\ISearch', function($c) {
return $this->getServer()->getSearch();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\Security\\ICrypto', function($c) {
return $this->getServer()->getCrypto();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\Security\\IHasher', function($c) {
return $this->getServer()->getHasher();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\Security\\ICredentialsManager', function($c) {
return $this->getServer()->getCredentialsManager();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\Security\\ISecureRandom', function($c) {
return $this->getServer()->getSecureRandom();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\Share\\IManager', function($c) {
return $this->getServer()->getShareManager();
});
$this->registerService('OCP\\SystemTag\\ISystemTagManager', function() {
return $this->getServer()->getSystemTagManager();
});
$this->registerService('OCP\\SystemTag\\ISystemTagObjectMapper', function() {
return $this->getServer()->getSystemTagObjectMapper();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('OCP\\IURLGenerator', function($c) {
return $this->getServer()->getURLGenerator();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\IUserManager', function($c) {
return $this->getServer()->getUserManager();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerService('OCP\\IUserSession', function($c) {
return $this->getServer()->getUserSession();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerAlias(\OC\User\Session::class, \OCP\IUserSession::class);
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
2015-08-07 14:28:57 +03:00
$this->registerService('OCP\\ISession', function($c) {
return $this->getServer()->getSession();
});
Add public API to give developers the possibility to adjust the global CSP defaults Allows to inject something into the default content policy. This is for example useful when you're injecting Javascript code into a view belonging to another controller and cannot modify its Content-Security-Policy itself. Note that the adjustment is only applied to applications that use AppFramework controllers. To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`, $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`. To test this add something like the following into an `app.php` of any enabled app: ``` $manager = \OC::$server->getContentSecurityPolicyManager(); $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(false); $policy->addAllowedFrameDomain('asdf'); $policy->addAllowedScriptDomain('yolo.com'); $policy->allowInlineScript(false); $manager->addDefaultPolicy($policy); $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(false); $policy->addAllowedFontDomain('yolo.com'); $manager->addDefaultPolicy($policy); $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(false); $policy->addAllowedFrameDomain('banana.com'); $manager->addDefaultPolicy($policy); ``` If you now open the files app the policy should be: ``` Content-Security-Policy:default-src 'none';script-src yolo.com 'self' 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src yolo.com 'self';connect-src 'self';media-src 'self';frame-src asdf banana.com 'self' ```
2016-01-28 16:33:02 +03:00
$this->registerService('OCP\\Security\\IContentSecurityPolicyManager', function($c) {
return $this->getServer()->getContentSecurityPolicyManager();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('ServerContainer', function ($c) {
return $this->getServer();
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
});
$this->registerAlias('OCP\\IServerContainer', 'ServerContainer');
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('Symfony\Component\EventDispatcher\EventDispatcherInterface', function ($c) {
return $this->getServer()->getEventDispatcher();
});
$this->registerService('OCP\WorkflowEngine\IManager', function ($c) {
return $c->query('OCA\WorkflowEngine\Manager');
});
$this->registerService('OCP\\AppFramework\\IAppContainer', function ($c) {
return $c;
});
$this->registerService(IMountManager::class, function () {
return $this->getServer()->getMountManager();
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
// commonly used attributes
$this->registerService('UserId', function ($c) {
return $c->query('OCP\\IUserSession')->getSession()->get('user_id');
});
$this->registerService('WebRoot', function ($c) {
return $c->query('ServerContainer')->getWebRoot();
});
$this->registerService('fromMailAddress', function() {
return Util::getDefaultEmailAddress('no-reply');
});
$this->registerService('OC_Defaults', function ($c) {
return $c->getServer()->getThemingDefaults();
});
$this->registerService('OCP\Encryption\IManager', function ($c) {
return $this->getServer()->getEncryptionManager();
2016-08-11 16:50:31 +03:00
});
$this->registerService(IValidator::class, function($c) {
return $c->query(Validator::class);
});
$this->registerService(\OC\Security\IdentityProof\Manager::class, function ($c) {
return new \OC\Security\IdentityProof\Manager(
$this->getServer()->getAppDataDir('identityproof'),
$this->getServer()->getCrypto()
);
});
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
2013-08-17 13:16:48 +04:00
/**
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
* App Framework APIs
2013-08-17 13:16:48 +04:00
*/
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
$this->registerService('API', function($c){
$c->query('OCP\\ILogger')->debug(
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
'Accessing the API class is deprecated! Use the appropriate ' .
'services instead!'
);
return new API($c['AppName']);
});
2014-11-03 15:10:03 +03:00
$this->registerService('Protocol', function($c){
/** @var \OC\Server $server */
$server = $c->query('ServerContainer');
$protocol = $server->getRequest()->getHttpProtocol();
return new Http($_SERVER, $protocol);
2013-08-17 13:16:48 +04:00
});
2014-11-03 15:10:03 +03:00
$this->registerService('Dispatcher', function($c) {
return new Dispatcher(
$c['Protocol'],
$c['MiddlewareDispatcher'],
2014-05-06 18:31:08 +04:00
$c['ControllerMethodReflector'],
$c['Request']
);
2013-08-17 13:16:48 +04:00
});
2016-07-22 11:11:53 +03:00
/**
* App Framework default arguments
*/
$this->registerParameter('corsMethods', 'PUT, POST, GET, DELETE, PATCH');
$this->registerParameter('corsAllowedHeaders', 'Authorization, Content-Type, Accept');
$this->registerParameter('corsMaxAge', 1728000);
2013-08-17 13:16:48 +04:00
/**
* Middleware
*/
$app = $this;
2014-11-03 15:10:03 +03:00
$this->registerService('SecurityMiddleware', function($c) use ($app){
/** @var \OC\Server $server */
$server = $app->getServer();
return new SecurityMiddleware(
$c['Request'],
$c['ControllerMethodReflector'],
$server->getNavigationManager(),
$server->getURLGenerator(),
$server->getLogger(),
$server->getSession(),
$c['AppName'],
$app->isLoggedIn(),
Add public API to give developers the possibility to adjust the global CSP defaults Allows to inject something into the default content policy. This is for example useful when you're injecting Javascript code into a view belonging to another controller and cannot modify its Content-Security-Policy itself. Note that the adjustment is only applied to applications that use AppFramework controllers. To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`, $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`. To test this add something like the following into an `app.php` of any enabled app: ``` $manager = \OC::$server->getContentSecurityPolicyManager(); $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(false); $policy->addAllowedFrameDomain('asdf'); $policy->addAllowedScriptDomain('yolo.com'); $policy->allowInlineScript(false); $manager->addDefaultPolicy($policy); $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(false); $policy->addAllowedFontDomain('yolo.com'); $manager->addDefaultPolicy($policy); $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(false); $policy->addAllowedFrameDomain('banana.com'); $manager->addDefaultPolicy($policy); ``` If you now open the files app the policy should be: ``` Content-Security-Policy:default-src 'none';script-src yolo.com 'self' 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src yolo.com 'self';connect-src 'self';media-src 'self';frame-src asdf banana.com 'self' ```
2016-01-28 16:33:02 +03:00
$app->isAdminUser(),
$server->getContentSecurityPolicyManager(),
$server->getCsrfTokenManager(),
$server->getContentSecurityPolicyNonceManager(),
$server->getBruteForceThrottler()
);
2013-08-17 13:16:48 +04:00
});
2014-11-03 15:10:03 +03:00
$this->registerService('CORSMiddleware', function($c) {
return new CORSMiddleware(
$c['Request'],
$c['ControllerMethodReflector'],
$c['OCP\IUserSession'],
$c->getServer()->getBruteForceThrottler()
);
});
2014-11-03 15:10:03 +03:00
$this->registerService('SessionMiddleware', function($c) use ($app) {
return new SessionMiddleware(
$c['Request'],
$c['ControllerMethodReflector'],
$app->getServer()->getSession()
);
});
2016-05-11 12:23:25 +03:00
$this->registerService('TwoFactorMiddleware', function (SimpleContainer $c) use ($app) {
$twoFactorManager = $c->getServer()->getTwoFactorAuthManager();
$userSession = $app->getServer()->getUserSession();
$session = $app->getServer()->getSession();
$urlGenerator = $app->getServer()->getURLGenerator();
$reflector = $c['ControllerMethodReflector'];
$request = $app->getServer()->getRequest();
return new TwoFactorMiddleware($twoFactorManager, $userSession, $session, $urlGenerator, $reflector, $request);
2016-05-11 12:23:25 +03:00
});
$this->registerService('OCSMiddleware', function (SimpleContainer $c) {
return new OCSMiddleware(
$c['Request']
);
});
$middleWares = &$this->middleWares;
2014-11-03 15:10:03 +03:00
$this->registerService('MiddlewareDispatcher', function($c) use (&$middleWares) {
2013-08-17 13:16:48 +04:00
$dispatcher = new MiddlewareDispatcher();
$dispatcher->registerMiddleware($c['CORSMiddleware']);
$dispatcher->registerMiddleware($c['OCSMiddleware']);
$dispatcher->registerMiddleware($c['SecurityMiddleware']);
2016-05-11 12:23:25 +03:00
$dispatcher->registerMiddleWare($c['TwoFactorMiddleware']);
2013-08-17 13:16:48 +04:00
foreach($middleWares as $middleWare) {
$dispatcher->registerMiddleware($c[$middleWare]);
2013-09-27 19:15:26 +04:00
}
$dispatcher->registerMiddleware($c['SessionMiddleware']);
2013-08-17 13:16:48 +04:00
return $dispatcher;
});
}
2013-08-21 03:02:15 +04:00
/**
2014-12-16 21:50:31 +03:00
* @deprecated implements only deprecated methods
2013-08-21 03:02:15 +04:00
* @return IApi
*/
function getCoreApi()
{
return $this->query('API');
}
/**
* @return \OCP\IServerContainer
2013-08-21 03:02:15 +04:00
*/
function getServer()
{
return $this->server;
2013-08-21 03:02:15 +04:00
}
/**
* @param string $middleWare
* @return boolean|null
*/
function registerMiddleWare($middleWare) {
2013-09-27 19:15:26 +04:00
array_push($this->middleWares, $middleWare);
}
/**
* used to return the appname of the set application
* @return string the name of your application
*/
function getAppName() {
return $this->query('AppName');
}
/**
* @deprecated use IUserSession->isLoggedIn()
* @return boolean
*/
function isLoggedIn() {
return \OC::$server->getUserSession()->isLoggedIn();
}
/**
* @deprecated use IGroupManager->isAdmin($userId)
* @return boolean
*/
function isAdminUser() {
$uid = $this->getUserId();
return \OC_User::isAdminUser($uid);
}
private function getUserId() {
return $this->getServer()->getSession()->get('user_id');
}
/**
2014-12-16 21:50:31 +03:00
* @deprecated use the ILogger instead
* @param string $message
* @param string $level
* @return mixed
*/
function log($message, $level) {
switch($level){
case 'debug':
$level = \OCP\Util::DEBUG;
break;
case 'info':
$level = \OCP\Util::INFO;
break;
case 'warn':
$level = \OCP\Util::WARN;
break;
case 'fatal':
$level = \OCP\Util::FATAL;
break;
default:
$level = \OCP\Util::ERROR;
break;
}
\OCP\Util::writeLog($this->getAppName(), $message, $level);
}
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
/**
* Register a capability
*
* @param string $serviceName e.g. 'OCA\Files\Capabilities'
*/
public function registerCapability($serviceName) {
$this->query('OC\CapabilitiesManager')->registerCapability(function() use ($serviceName) {
return $this->query($serviceName);
});
}
Intelligent container * resolves dependencies by type hint or variable name * simpler route.php * implementation of https://github.com/owncloud/core/issues/12829 Generates and injects parameters automatically. You can now build full classes like $c->query('MyClassName') without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken. Therefore the following two implementations are identical: class Class1 { function __construct(MyClassName $class) class Class1 { function __construct($MyClassName) This makes it possible to also inject primitive values such as strings, arrays etc. In addition if the query could not be resolved, a `QueryException` is now thrown Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional Old commit messages: make it possible to return the routes instead of having to intialize the application try to get the controller by convention add first implementation of automatic resolve add another test just to be sure store the resolved object more tests add phpdoc to public app.php method use the same variable for the public app.php method deprecate old methods and add services for public interfaces deprecated getServer method disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D) register userid because its such an often used variable fix indention and leading slash use test namespace add deprecation reasons, remove private api usage checks and remove deprecation from getServer() add additional public interfaces add public interface for rootfolder fix syntax error remove deprecation from methods where no alternative is there yet remove deprecated from method which has no alternative add timezone public service for #12881 add another deprecation hint move deprecation into separate branch remove dead comment first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter also trim the namespace name add an interface for timefactory move timefactory to public and add icontrollermethodreflector keep core interface fix copyright date in headers
2014-12-13 21:28:20 +03:00
public function query($name) {
$name = $this->sanitizeName($name);
if ($this->offsetExists($name)) {
return parent::query($name);
} else {
if (strpos($name, 'OCA\\') === 0 && substr_count($name, '\\') >= 2) {
$segments = explode('\\', $name);
if (strtolower($segments[1]) === strtolower($this['AppName'])) {
return parent::query($name);
}
}
}
return $this->getServer()->query($name);
}
2013-08-17 13:16:48 +04:00
}