mirror of
https://github.com/friendica/friendica
synced 2024-12-22 17:20: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\Core\Cache\ICache;
|
||||
use Friendica\Core\Cache\Enum\Type;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
@ -63,7 +62,7 @@ class SessionFactory
|
|||
|
||||
try {
|
||||
if ($mode->isInstall() || $mode->isBackend()) {
|
||||
$session = new Session\Memory();
|
||||
$session = new Session\Type\Memory();
|
||||
} else {
|
||||
$session_handler = $config->get('system', 'session_handler', self::HANDLER_DEFAULT);
|
||||
$handler = null;
|
||||
|
@ -82,7 +81,7 @@ class SessionFactory
|
|||
break;
|
||||
}
|
||||
|
||||
$session = new Session\Native($baseURL, $handler);
|
||||
$session = new Session\Type\Native($baseURL, $handler);
|
||||
}
|
||||
} finally {
|
||||
$profiler->stopRecording();
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Core\Session;
|
||||
namespace Friendica\Core\Session\Type;
|
||||
|
||||
/**
|
||||
* 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
|
|
@ -19,9 +19,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Core\Session;
|
||||
namespace Friendica\Core\Session\Type;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Session\ISession;
|
||||
use Friendica\Model\User\Cookie;
|
||||
use SessionHandlerInterface;
|
||||
|
|
@ -207,7 +207,7 @@ return [
|
|||
],
|
||||
],
|
||||
ISession::class => [
|
||||
'instanceOf' => Factory\SessionFactory::class,
|
||||
'instanceOf' => \Friendica\Core\Session\Factory\SessionFactory::class,
|
||||
'call' => [
|
||||
['createSession', [$_SERVER], Dice::CHAIN_CALL],
|
||||
['start', [], Dice::CHAIN_CALL],
|
||||
|
|
|
@ -33,7 +33,7 @@ abstract class FixtureTest extends DatabaseTest
|
|||
$this->dice = (new Dice())
|
||||
->addRules(include __DIR__ . '/../static/dependencies.config.php')
|
||||
->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);
|
||||
|
||||
/** @var IConfig $config */
|
||||
|
|
|
@ -253,7 +253,7 @@ class StorageManagerTest extends DatabaseTest
|
|||
$dice = (new Dice())
|
||||
->addRules(include __DIR__ . '/../../../static/dependencies.config.php')
|
||||
->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);
|
||||
|
||||
$storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
|
||||
|
@ -281,7 +281,7 @@ class StorageManagerTest extends DatabaseTest
|
|||
$dice = (new Dice())
|
||||
->addRules(include __DIR__ . '/../../../static/dependencies.config.php')
|
||||
->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);
|
||||
|
||||
$storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
|
||||
|
|
Loading…
Reference in a new issue