diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-07-16 19:40:22 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-08-29 10:22:21 +0200 |
commit | f551917a3ca2cedf748337646ed4b1d398ac8437 (patch) | |
tree | eccf53eb77c44019ef59e90c41af43297993ddf9 /lib/private/server.php | |
parent | ed2424c3822a3470065788ff113a3807d24d80dc (diff) | |
download | nextcloud-server-f551917a3ca2cedf748337646ed4b1d398ac8437.tar.gz nextcloud-server-f551917a3ca2cedf748337646ed4b1d398ac8437.zip |
kill OC::$session
maintain deprecated \OC::$session when getting or setting the session via the server container or UserSession
restore order os OC::$session and OC::$CLI
remove unneded initialization of dummy session
write back session when $useCustomSession is true
log warning when deprecated app is used
Diffstat (limited to 'lib/private/server.php')
-rw-r--r-- | lib/private/server.php | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index aab3c82bfeb..53aab7a586a 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -10,6 +10,7 @@ use OC\DB\ConnectionWrapper; use OC\Files\Node\Root; use OC\Files\View; use OCP\IServerContainer; +use OCP\ISession; /** * Class Server @@ -31,8 +32,8 @@ class Server extends SimpleContainer implements IServerContainer { $urlParams = array(); } - if (\OC::$session->exists('requesttoken')) { - $requestToken = \OC::$session->get('requesttoken'); + if (\OC::$server->getSession()->exists('requesttoken')) { + $requestToken = \OC::$server->getSession()->get('requesttoken'); } else { $requestToken = false; } @@ -100,7 +101,7 @@ class Server extends SimpleContainer implements IServerContainer { * @var \OC\User\Manager $manager */ $manager = $c->query('UserManager'); - $userSession = new \OC\User\Session($manager, \OC::$session); + $userSession = new \OC\User\Session($manager, new \OC\Session\Memory('')); $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); }); @@ -328,6 +329,20 @@ class Server extends SimpleContainer implements IServerContainer { } /** + * @return \OCP\ISession + */ + function getSession() { + return $this->query('UserSession')->getSession(); + } + + /** + * @param \OCP\ISession $session + */ + function setSession(\OCP\ISession $session) { + return $this->query('UserSession')->setSession($session); + } + + /** * @return \OC\NavigationManager */ function getNavigationManager() { @@ -395,15 +410,6 @@ class Server extends SimpleContainer implements IServerContainer { /** * Returns the current session * - * @return \OCP\ISession - */ - function getSession() { - return \OC::$session; - } - - /** - * Returns the current session - * * @return \OCP\IDBConnection */ function getDatabaseConnection() { |