diff options
Diffstat (limited to 'lib/private/server.php')
-rw-r--r-- | lib/private/server.php | 99 |
1 files changed, 85 insertions, 14 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index 518b0cb2d92..9657afbdaec 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -53,6 +53,7 @@ use OC\Lock\DBLockingProvider; use OC\Lock\MemcacheLockingProvider; use OC\Lock\NoopLockingProvider; use OC\Mail\Mailer; +use OC\Notification\Manager; use OC\Security\CertificateManager; use OC\Security\Crypto; use OC\Security\Hasher; @@ -91,12 +92,25 @@ class Server extends SimpleContainer implements IServerContainer { }); $this->registerService('EncryptionManager', function (Server $c) { - return new Encryption\Manager($c->getConfig(), $c->getLogger(), $c->getL10N('core')); + $view = new View(); + $util = new Encryption\Util( + $view, + $c->getUserManager(), + $c->getGroupManager(), + $c->getConfig() + ); + return new Encryption\Manager( + $c->getConfig(), + $c->getLogger(), + $c->getL10N('core'), + new View(), + $util + ); }); $this->registerService('EncryptionFileHelper', function (Server $c) { - $util = new \OC\Encryption\Util( - new \OC\Files\View(), + $util = new Encryption\Util( + new View(), $c->getUserManager(), $c->getGroupManager(), $c->getConfig() @@ -105,8 +119,8 @@ class Server extends SimpleContainer implements IServerContainer { }); $this->registerService('EncryptionKeyStorage', function (Server $c) { - $view = new \OC\Files\View(); - $util = new \OC\Encryption\Util( + $view = new View(); + $util = new Encryption\Util( $view, $c->getUserManager(), $c->getGroupManager(), @@ -164,8 +178,6 @@ class Server extends SimpleContainer implements IServerContainer { $manager = $c->getUserManager(); $session = new \OC\Session\Memory(''); - $cryptoWrapper = $c->getSessionCryptoWrapper(); - $session = $cryptoWrapper->wrapSession($session); $userSession = new \OC\User\Session($manager, $session); $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { @@ -239,7 +251,7 @@ class Server extends SimpleContainer implements IServerContainer { if($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { $v = \OC_App::getAppVersions(); - $v['core'] = implode('.', \OC_Util::getVersion()); + $v['core'] = md5(file_get_contents(\OC::$SERVERROOT . '/version.php')); $version = implode(',', $v); $instanceId = \OC_Util::getInstanceId(); $path = \OC::$SERVERROOT; @@ -326,7 +338,7 @@ class Server extends SimpleContainer implements IServerContainer { $uid = $user ? $user : null; return new ClientService( $c->getConfig(), - new \OC\Security\CertificateManager($uid, new \OC\Files\View()) + new \OC\Security\CertificateManager($uid, new View(), $c->getConfig()) ); }); $this->registerService('EventLogger', function (Server $c) { @@ -441,13 +453,13 @@ class Server extends SimpleContainer implements IServerContainer { ); }); $this->registerService('LockingProvider', function (Server $c) { - if ($c->getConfig()->getSystemValue('filelocking.enabled', false) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { + if ($c->getConfig()->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { /** @var \OC\Memcache\Factory $memcacheFactory */ $memcacheFactory = $c->getMemCacheFactory(); $memcache = $memcacheFactory->createLocking('lock'); -// if (!($memcache instanceof \OC\Memcache\NullCache)) { -// return new MemcacheLockingProvider($memcache); -// } + if (!($memcache instanceof \OC\Memcache\NullCache)) { + return new MemcacheLockingProvider($memcache); + } return new DBLockingProvider($c->getDatabaseConnection(), $c->getLogger()); } return new NoopLockingProvider(); @@ -460,6 +472,14 @@ class Server extends SimpleContainer implements IServerContainer { $c->getURLGenerator(), \OC::$configDir); }); + $this->registerService('MimeTypeLoader', function(Server $c) { + return new \OC\Files\Type\Loader( + $c->getDatabaseConnection() + ); + }); + $this->registerService('NotificationManager', function() { + return new Manager(); + }); $this->registerService('CapabilitiesManager', function (Server $c) { $manager = new \OC\CapabilitiesManager(); $manager->registerCapability(function() use ($c) { @@ -842,7 +862,7 @@ class Server extends SimpleContainer implements IServerContainer { } $userId = $user->getUID(); } - return new CertificateManager($userId, new \OC\Files\View()); + return new CertificateManager($userId, new View(), $this->getConfig()); } /** @@ -1001,6 +1021,15 @@ class Server extends SimpleContainer implements IServerContainer { } /** + * Get the MimeTypeLoader + * + * @return \OCP\Files\IMimeTypeLoader + */ + public function getMimeTypeLoader() { + return $this->query('MimeTypeLoader'); + } + + /** * Get the manager of all the capabilities * * @return \OC\CapabilitiesManager @@ -1020,9 +1049,51 @@ class Server extends SimpleContainer implements IServerContainer { } /** + * Get the Notification Manager + * + * @return \OC\Notification\IManager + * @since 8.2.0 + */ + public function getNotificationManager() { + return $this->query('NotificationManager'); + } + + /** * @return \OC\Session\CryptoWrapper */ public function getSessionCryptoWrapper() { return $this->query('CryptoWrapper'); } + + /** + * Not a public API as of 8.2, wait for 9.0 + * @return \OCA\Files_External\Service\BackendService + */ + public function getStoragesBackendService() { + return \OC_Mount_Config::$app->getContainer()->query('OCA\\Files_External\\Service\\BackendService'); + } + + /** + * Not a public API as of 8.2, wait for 9.0 + * @return \OCA\Files_External\Service\GlobalStoragesService + */ + public function getGlobalStoragesService() { + return \OC_Mount_Config::$app->getContainer()->query('OCA\\Files_External\\Service\\GlobalStoragesService'); + } + + /** + * Not a public API as of 8.2, wait for 9.0 + * @return \OCA\Files_External\Service\UserGlobalStoragesService + */ + public function getUserGlobalStoragesService() { + return \OC_Mount_Config::$app->getContainer()->query('OCA\\Files_External\\Service\\UserGlobalStoragesService'); + } + + /** + * Not a public API as of 8.2, wait for 9.0 + * @return \OCA\Files_External\Service\UserStoragesService + */ + public function getUserStoragesService() { + return \OC_Mount_Config::$app->getContainer()->query('OCA\\Files_External\\Service\\UserStoragesService'); + } } |