mirror of
https://github.com/friendica/friendica
synced 2025-04-27 12:30:11 +00:00
Extend IHandleUserSessions
from IHandleSessions
and adapt classes
This commit is contained in:
parent
b72d727a06
commit
b5bc1b0844
14 changed files with 165 additions and 138 deletions
|
@ -22,9 +22,9 @@
|
|||
namespace Friendica\Core\Session\Capability;
|
||||
|
||||
/**
|
||||
* Handles user infos based on session infos
|
||||
* This interface handles UserSessions, which is directly extended from the global Session interface
|
||||
*/
|
||||
interface IHandleUserSessions
|
||||
interface IHandleUserSessions extends IHandleSessions
|
||||
{
|
||||
/**
|
||||
* Returns the user id of locally logged-in user or false.
|
||||
|
@ -88,8 +88,6 @@ interface IHandleUserSessions
|
|||
|
||||
/**
|
||||
* Set the session variable that contains the contact IDs for the visitor's contact URL
|
||||
*
|
||||
* @param string $url Contact URL
|
||||
*/
|
||||
public function setVisitorsContacts();
|
||||
}
|
||||
|
|
|
@ -55,10 +55,8 @@ class Session
|
|||
* @param LoggerInterface $logger
|
||||
* @param Profiler $profiler
|
||||
* @param array $server
|
||||
*
|
||||
* @return IHandleSessions
|
||||
*/
|
||||
public function createSession(App\Mode $mode, App\BaseURL $baseURL, IManageConfigValues $config, Database $dba, Cache $cacheFactory, LoggerInterface $logger, Profiler $profiler, array $server = [])
|
||||
public function createSession(App\Mode $mode, App\BaseURL $baseURL, IManageConfigValues $config, Database $dba, Cache $cacheFactory, LoggerInterface $logger, Profiler $profiler, array $server = []): IHandleSessions
|
||||
{
|
||||
$profiler->startRecording('session');
|
||||
$session = null;
|
||||
|
|
|
@ -25,6 +25,9 @@ use Friendica\Core\Session\Capability\IHandleSessions;
|
|||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
/**
|
||||
* This class handles user sessions, which is directly extended from regular session
|
||||
*/
|
||||
class UserSession implements IHandleUserSessions
|
||||
{
|
||||
/** @var IHandleSessions */
|
||||
|
@ -130,4 +133,52 @@ class UserSession implements IHandleUserSessions
|
|||
{
|
||||
$this->session->set('submanage', $managed_uid);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function start(): IHandleSessions
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function exists(string $name): bool
|
||||
{
|
||||
return $this->session->exists($name);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function get(string $name, $defaults = null)
|
||||
{
|
||||
return $this->session->get($name, $defaults);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function pop(string $name, $defaults = null)
|
||||
{
|
||||
return $this->session->pop($name, $defaults);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function set(string $name, $value)
|
||||
{
|
||||
$this->session->set($name, $value);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function setMultiple(array $values)
|
||||
{
|
||||
$this->session->setMultiple($values);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function remove(string $name)
|
||||
{
|
||||
$this->session->remove($name);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function clear()
|
||||
{
|
||||
$this->session->clear();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue