diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-08-21 18:27:52 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-08-21 19:16:28 +0200 |
commit | 6a3fb0d3b36dce7a6583d58ded1b133f086e2a95 (patch) | |
tree | f71899e7cc21d88b9224f4b7111dc40d54e34a84 /lib/private/server.php | |
parent | 36eef2ddabd77ff6279f3bd6896ced4959f1c370 (diff) | |
download | nextcloud-server-6a3fb0d3b36dce7a6583d58ded1b133f086e2a95.tar.gz nextcloud-server-6a3fb0d3b36dce7a6583d58ded1b133f086e2a95.zip |
Handle failures gracefully, remove switch
Diffstat (limited to 'lib/private/server.php')
-rw-r--r-- | lib/private/server.php | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index 61eb3c736bf..c47486ab95b 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -40,6 +40,7 @@ use bantu\IniGetWrapper\IniGetWrapper; use OC\AppFramework\Http\Request; use OC\AppFramework\Db\Db; use OC\AppFramework\Utility\SimpleContainer; +use OC\AppFramework\Utility\TimeFactory; use OC\Command\AsyncBus; use OC\Diagnostics\EventLogger; use OC\Diagnostics\NullEventLogger; @@ -468,10 +469,28 @@ class Server extends SimpleContainer implements IServerContainer { return new EventDispatcher(); }); $this->registerService('CryptoWrapper', function (Server $c) { + // FIXME: Instantiiated here due to cyclic dependency + $request = new Request( + [ + 'get' => $_GET, + 'post' => $_POST, + 'files' => $_FILES, + 'server' => $_SERVER, + 'env' => $_ENV, + 'cookies' => $_COOKIE, + 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD'])) + ? $_SERVER['REQUEST_METHOD'] + : null, + ], + new SecureRandom(), + $c->getConfig() + ); + return new CryptoWrapper( $c->getConfig(), $c->getCrypto(), - $c->getSecureRandom() + $c->getSecureRandom(), + $request ); }); } @@ -962,4 +981,38 @@ class Server extends SimpleContainer implements IServerContainer { return $this->query('MountManager'); } + /* + * Get the MimeTypeDetector + * + * @return \OCP\Files\IMimeTypeDetector + */ + public function getMimeTypeDetector() { + return $this->query('MimeTypeDetector'); + } + + /** + * Get the manager of all the capabilities + * + * @return \OC\CapabilitiesManager + */ + public function getCapabilitiesManager() { + return $this->query('CapabilitiesManager'); + } + + /** + * Get the EventDispatcher + * + * @return EventDispatcherInterface + * @since 8.2.0 + */ + public function getEventDispatcher() { + return $this->query('EventDispatcher'); + } + + /** + * @return \OC\Session\CryptoWrapper + */ + public function getSessionCryptoWrapper() { + return $this->query('CryptoWrapper'); + } } |