diff options
author | Christoph Wurst <christoph@owncloud.com> | 2016-04-26 12:48:19 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-05-11 13:36:46 +0200 |
commit | 8d4850218740b74faae5af637d1b1c2b3dee3c41 (patch) | |
tree | a54f2a3efc72f58fea3909a017211ac26027fbf2 /lib/private/User | |
parent | 53636c73d649514fbbfeba4741f39be1725e47fd (diff) | |
download | nextcloud-server-8d4850218740b74faae5af637d1b1c2b3dee3c41.tar.gz nextcloud-server-8d4850218740b74faae5af637d1b1c2b3dee3c41.zip |
Add index on 'last_activity'
add token type column and delete only temporary tokens in the background job
debounce token updates; fix wrong class import
Diffstat (limited to 'lib/private/User')
-rw-r--r-- | lib/private/User/Session.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 5d869a04ca2..976a2627735 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -38,7 +38,6 @@ use OC\Authentication\Exceptions\InvalidTokenException; use OC\Authentication\Token\DefaultTokenProvider; use OC\Authentication\Token\IProvider; use OC\Hooks\Emitter; -use OC\Session\Session; use OC_User; use OCA\DAV\Connector\Sabre\Auth; use OCP\IRequest; @@ -73,7 +72,7 @@ class Session implements IUserSession, Emitter { private $manager; /* - * @var Session $session + * @var ISession $session */ private $session; @@ -219,7 +218,12 @@ class Session implements IUserSession, Emitter { } // Session is valid, so the token can be refreshed - $this->tokenProvider->updateToken($token); + // To save unnecessary DB queries, this is only done once a minute + $lastTokenUpdate = $this->session->get('last_token_update') ? : 0; + if ($lastTokenUpdate < (time () - 60)) { + $this->tokenProvider->updateToken($token); + $this->session->set('last_token_update', time()); + } return true; } |