Session - Remove unneeded cookie parameter

This commit is contained in:
nupplaPhil 2019-12-29 00:03:58 +01:00
parent ae0421f321
commit 673c4537e4
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
4 changed files with 5 additions and 23 deletions

View file

@ -3,21 +3,11 @@
namespace Friendica\Core\Session; namespace Friendica\Core\Session;
use Friendica\Model\User\Cookie;
/** /**
* Contains the base methods for $_SESSION interaction * Contains the base methods for $_SESSION interaction
*/ */
class AbstractSession class AbstractSession
{ {
/** @var Cookie */
protected $cookie;
public function __construct( Cookie $cookie)
{
$this->cookie = $cookie;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

View file

@ -2,8 +2,6 @@
namespace Friendica\Core\Session; namespace Friendica\Core\Session;
use Friendica\Model\User\Cookie;
/** /**
* Usable for backend processes (daemon/worker) and testing * Usable for backend processes (daemon/worker) and testing
* *
@ -11,10 +9,8 @@ use Friendica\Model\User\Cookie;
*/ */
final class Memory extends AbstractSession implements ISession final class Memory extends AbstractSession implements ISession
{ {
public function __construct(Cookie $cookie) public function __construct()
{ {
parent::__construct($cookie);
// Backward compatibility until all Session variables are replaced // Backward compatibility until all Session variables are replaced
// with the Session class // with the Session class
$_SESSION = []; $_SESSION = [];

View file

@ -11,10 +11,8 @@ use SessionHandlerInterface;
*/ */
final class Native extends AbstractSession implements ISession final class Native extends AbstractSession implements ISession
{ {
public function __construct(App\BaseURL $baseURL, Cookie $cookie, SessionHandlerInterface $handler = null) public function __construct(App\BaseURL $baseURL, SessionHandlerInterface $handler = null)
{ {
parent::__construct($cookie);
ini_set('session.gc_probability', 50); ini_set('session.gc_probability', 50);
ini_set('session.use_only_cookies', 1); ini_set('session.use_only_cookies', 1);
ini_set('session.cookie_httponly', (int)Cookie::HTTPONLY); ini_set('session.cookie_httponly', (int)Cookie::HTTPONLY);

View file

@ -9,7 +9,6 @@ use Friendica\Core\Config\Configuration;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Model\User\Cookie;
use Friendica\Util\Profiler; use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -31,7 +30,6 @@ class SessionFactory
* @param App\Mode $mode * @param App\Mode $mode
* @param App\BaseURL $baseURL * @param App\BaseURL $baseURL
* @param Configuration $config * @param Configuration $config
* @param Cookie $cookie
* @param Database $dba * @param Database $dba
* @param ICache $cache * @param ICache $cache
* @param LoggerInterface $logger * @param LoggerInterface $logger
@ -39,14 +37,14 @@ class SessionFactory
* *
* @return Session\ISession * @return Session\ISession
*/ */
public function createSession(App\Mode $mode, App\BaseURL $baseURL, Configuration $config, Cookie $cookie, Database $dba, ICache $cache, LoggerInterface $logger, Profiler $profiler, array $server = []) public function createSession(App\Mode $mode, App\BaseURL $baseURL, Configuration $config, Database $dba, ICache $cache, LoggerInterface $logger, Profiler $profiler, array $server = [])
{ {
$stamp1 = microtime(true); $stamp1 = microtime(true);
$session = null; $session = null;
try { try {
if ($mode->isInstall() || $mode->isBackend()) { if ($mode->isInstall() || $mode->isBackend()) {
$session = new Session\Memory($cookie); $session = new Session\Memory();
} else { } else {
$session_handler = $config->get('system', 'session_handler', self::HANDLER_DEFAULT); $session_handler = $config->get('system', 'session_handler', self::HANDLER_DEFAULT);
$handler = null; $handler = null;
@ -65,7 +63,7 @@ class SessionFactory
break; break;
} }
$session = new Session\Native($baseURL, $cookie, $handler); $session = new Session\Native($baseURL, $handler);
} }
} finally { } finally {
$profiler->saveTimestamp($stamp1, 'parser', System::callstack()); $profiler->saveTimestamp($stamp1, 'parser', System::callstack());