mirror of
https://github.com/filegator/filegator.git
synced 2025-08-13 21:44:03 +02:00
session handler config upd
This commit is contained in:
@@ -30,7 +30,7 @@ class SessionStorage implements Service, SessionStorageInterface
|
||||
{
|
||||
// we don't have a previous session attached
|
||||
if (! $this->getSession()) {
|
||||
$handler = $config['available'][$config['session_handler']];
|
||||
$handler = $config['handler'];
|
||||
$session = new Session($handler());
|
||||
$session->setName('filegator');
|
||||
|
||||
|
@@ -32,16 +32,13 @@ return [
|
||||
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
||||
'config' => [
|
||||
'session_handler' => 'filesession',
|
||||
'available' => [
|
||||
'filesession' => function () {
|
||||
$save_path = null; // use default system path
|
||||
//$save_path = __DIR__.'/private/sessions';
|
||||
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler($save_path);
|
||||
'handler' => function () {
|
||||
$save_path = null; // use default system path
|
||||
//$save_path = __DIR__.'/private/sessions';
|
||||
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler($save_path);
|
||||
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([], $handler);
|
||||
},
|
||||
],
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([], $handler);
|
||||
},
|
||||
],
|
||||
],
|
||||
'Filegator\Services\Cors\Cors' => [
|
||||
|
@@ -21,4 +21,4 @@ Default handler will use simple ```/private/logs/app.log``` file to store applic
|
||||
],
|
||||
```
|
||||
|
||||
There are many different handlers you can use. Some of them are listed [here](https://github.com/Seldaek/monolog#documentation).
|
||||
There are many different handlers you can add ot top of the stack (monolog_handlers array). Some of them are listed [here](https://github.com/Seldaek/monolog#documentation).
|
||||
|
@@ -18,16 +18,13 @@ Then, open ```configuration.php``` and update Session handler to:
|
||||
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
||||
'config' => [
|
||||
'session_handler' => 'database',
|
||||
'available' => [
|
||||
'database' => function () {
|
||||
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
|
||||
'handler' => function () {
|
||||
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
|
||||
'mysql://root:password@localhost:3360/filegator'
|
||||
);
|
||||
);
|
||||
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([], $handler);
|
||||
},
|
||||
],
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([], $handler);
|
||||
},
|
||||
],
|
||||
],
|
||||
|
||||
@@ -43,18 +40,15 @@ For example you can pass ```cookie_lifetime``` parameter to extend default sessi
|
||||
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
||||
'config' => [
|
||||
'session_handler' => 'database',
|
||||
'available' => [
|
||||
'database' => function () {
|
||||
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
|
||||
'handler' => function () {
|
||||
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
|
||||
'mysql://root:password@localhost:3360/filegator'
|
||||
);
|
||||
);
|
||||
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([
|
||||
'cookie_lifetime' => 365 * 24 * 60 * 60, // one year
|
||||
], $handler);
|
||||
},
|
||||
],
|
||||
], $handler);
|
||||
},
|
||||
],
|
||||
],
|
||||
|
||||
|
@@ -25,12 +25,9 @@ abstract class AuthTest extends TestCase
|
||||
{
|
||||
$this->session = new SessionStorage(new Request());
|
||||
$this->session->init([
|
||||
'session_handler' => 'mockfilesession',
|
||||
'available' => [
|
||||
'mockfilesession' => function () {
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
||||
},
|
||||
],
|
||||
'handler' => function () {
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
||||
},
|
||||
]);
|
||||
|
||||
$this->setAuth();
|
||||
|
@@ -25,12 +25,9 @@ class SessionStorageTest extends TestCase
|
||||
{
|
||||
$this->session_service = new SessionStorage(new Request());
|
||||
$this->session_service->init([
|
||||
'session_handler' => 'mockfilesession',
|
||||
'available' => [
|
||||
'mockfilesession' => function () {
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
||||
},
|
||||
],
|
||||
'handler' => function () {
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
||||
},
|
||||
]);
|
||||
|
||||
parent::setUp();
|
||||
|
@@ -28,12 +28,9 @@ return [
|
||||
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
||||
'config' => [
|
||||
'session_handler' => 'mockfilesession',
|
||||
'available' => [
|
||||
'mockfilesession' => function () {
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
||||
},
|
||||
],
|
||||
'handler' => function () {
|
||||
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
||||
},
|
||||
],
|
||||
],
|
||||
'Filegator\Services\Tmpfs\TmpfsInterface' => [
|
||||
|
Reference in New Issue
Block a user