mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:40:16 +00:00
Restructure Session to follow new paradigm
This commit is contained in:
parent
ff1a812e1a
commit
57b4c008cb
7 changed files with 13 additions and 11 deletions
|
@ -19,14 +19,13 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Factory;
|
namespace Friendica\Core\Session\Factory;
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Cache\ICache;
|
use Friendica\Core\Cache\ICache;
|
||||||
use Friendica\Core\Cache\Enum\Type;
|
use Friendica\Core\Cache\Enum\Type;
|
||||||
use Friendica\Core\Config\IConfig;
|
use Friendica\Core\Config\IConfig;
|
||||||
use Friendica\Core\Session;
|
use Friendica\Core\Session;
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Util\Profiler;
|
use Friendica\Util\Profiler;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
@ -63,7 +62,7 @@ class SessionFactory
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($mode->isInstall() || $mode->isBackend()) {
|
if ($mode->isInstall() || $mode->isBackend()) {
|
||||||
$session = new Session\Memory();
|
$session = new Session\Type\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;
|
||||||
|
@ -82,7 +81,7 @@ class SessionFactory
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$session = new Session\Native($baseURL, $handler);
|
$session = new Session\Type\Native($baseURL, $handler);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
$profiler->stopRecording();
|
$profiler->stopRecording();
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Core\Session;
|
namespace Friendica\Core\Session\Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the base methods for $_SESSION interaction
|
* Contains the base methods for $_SESSION interaction
|
|
@ -19,7 +19,9 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Core\Session;
|
namespace Friendica\Core\Session\Type;
|
||||||
|
|
||||||
|
use Friendica\Core\Session\ISession;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usable for backend processes (daemon/worker) and testing
|
* Usable for backend processes (daemon/worker) and testing
|
|
@ -19,9 +19,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Core\Session;
|
namespace Friendica\Core\Session\Type;
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\Core\Session\ISession;
|
||||||
use Friendica\Model\User\Cookie;
|
use Friendica\Model\User\Cookie;
|
||||||
use SessionHandlerInterface;
|
use SessionHandlerInterface;
|
||||||
|
|
|
@ -207,7 +207,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
ISession::class => [
|
ISession::class => [
|
||||||
'instanceOf' => Factory\SessionFactory::class,
|
'instanceOf' => \Friendica\Core\Session\Factory\SessionFactory::class,
|
||||||
'call' => [
|
'call' => [
|
||||||
['createSession', [$_SERVER], Dice::CHAIN_CALL],
|
['createSession', [$_SERVER], Dice::CHAIN_CALL],
|
||||||
['start', [], Dice::CHAIN_CALL],
|
['start', [], Dice::CHAIN_CALL],
|
||||||
|
|
|
@ -33,7 +33,7 @@ abstract class FixtureTest extends DatabaseTest
|
||||||
$this->dice = (new Dice())
|
$this->dice = (new Dice())
|
||||||
->addRules(include __DIR__ . '/../static/dependencies.config.php')
|
->addRules(include __DIR__ . '/../static/dependencies.config.php')
|
||||||
->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true])
|
->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true])
|
||||||
->addRule(ISession::class, ['instanceOf' => Session\Memory::class, 'shared' => true, 'call' => null]);
|
->addRule(ISession::class, ['instanceOf' => Session\Type\Memory::class, 'shared' => true, 'call' => null]);
|
||||||
DI::init($this->dice);
|
DI::init($this->dice);
|
||||||
|
|
||||||
/** @var IConfig $config */
|
/** @var IConfig $config */
|
||||||
|
|
|
@ -253,7 +253,7 @@ class StorageManagerTest extends DatabaseTest
|
||||||
$dice = (new Dice())
|
$dice = (new Dice())
|
||||||
->addRules(include __DIR__ . '/../../../static/dependencies.config.php')
|
->addRules(include __DIR__ . '/../../../static/dependencies.config.php')
|
||||||
->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true])
|
->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true])
|
||||||
->addRule(ISession::class, ['instanceOf' => Session\Memory::class, 'shared' => true, 'call' => null]);
|
->addRule(ISession::class, ['instanceOf' => Session\Type\Memory::class, 'shared' => true, 'call' => null]);
|
||||||
DI::init($dice);
|
DI::init($dice);
|
||||||
|
|
||||||
$storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
|
$storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
|
||||||
|
@ -281,7 +281,7 @@ class StorageManagerTest extends DatabaseTest
|
||||||
$dice = (new Dice())
|
$dice = (new Dice())
|
||||||
->addRules(include __DIR__ . '/../../../static/dependencies.config.php')
|
->addRules(include __DIR__ . '/../../../static/dependencies.config.php')
|
||||||
->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true])
|
->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true])
|
||||||
->addRule(ISession::class, ['instanceOf' => Session\Memory::class, 'shared' => true, 'call' => null]);
|
->addRule(ISession::class, ['instanceOf' => Session\Type\Memory::class, 'shared' => true, 'call' => null]);
|
||||||
DI::init($dice);
|
DI::init($dice);
|
||||||
|
|
||||||
$storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
|
$storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
|
||||||
|
|
Loading…
Reference in a new issue