mirror of
https://github.com/filegator/filegator.git
synced 2025-08-15 13:44:37 +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
|
// we don't have a previous session attached
|
||||||
if (! $this->getSession()) {
|
if (! $this->getSession()) {
|
||||||
$handler = $config['available'][$config['session_handler']];
|
$handler = $config['handler'];
|
||||||
$session = new Session($handler());
|
$session = new Session($handler());
|
||||||
$session->setName('filegator');
|
$session->setName('filegator');
|
||||||
|
|
||||||
|
@@ -32,9 +32,7 @@ return [
|
|||||||
'Filegator\Services\Session\SessionStorageInterface' => [
|
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||||
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
||||||
'config' => [
|
'config' => [
|
||||||
'session_handler' => 'filesession',
|
'handler' => function () {
|
||||||
'available' => [
|
|
||||||
'filesession' => function () {
|
|
||||||
$save_path = null; // use default system path
|
$save_path = null; // use default system path
|
||||||
//$save_path = __DIR__.'/private/sessions';
|
//$save_path = __DIR__.'/private/sessions';
|
||||||
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler($save_path);
|
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler($save_path);
|
||||||
@@ -43,7 +41,6 @@ return [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
|
||||||
'Filegator\Services\Cors\Cors' => [
|
'Filegator\Services\Cors\Cors' => [
|
||||||
'handler' => '\Filegator\Services\Cors\Cors',
|
'handler' => '\Filegator\Services\Cors\Cors',
|
||||||
'config' => [
|
'config' => [
|
||||||
|
@@ -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,9 +18,7 @@ Then, open ```configuration.php``` and update Session handler to:
|
|||||||
'Filegator\Services\Session\SessionStorageInterface' => [
|
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||||
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
||||||
'config' => [
|
'config' => [
|
||||||
'session_handler' => 'database',
|
'handler' => function () {
|
||||||
'available' => [
|
|
||||||
'database' => function () {
|
|
||||||
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
|
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
|
||||||
'mysql://root:password@localhost:3360/filegator'
|
'mysql://root:password@localhost:3360/filegator'
|
||||||
);
|
);
|
||||||
@@ -29,7 +27,6 @@ Then, open ```configuration.php``` and update Session handler to:
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
|
||||||
|
|
||||||
```
|
```
|
||||||
Don't forget to enter correct database details.
|
Don't forget to enter correct database details.
|
||||||
@@ -43,9 +40,7 @@ For example you can pass ```cookie_lifetime``` parameter to extend default sessi
|
|||||||
'Filegator\Services\Session\SessionStorageInterface' => [
|
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||||
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
||||||
'config' => [
|
'config' => [
|
||||||
'session_handler' => 'database',
|
'handler' => function () {
|
||||||
'available' => [
|
|
||||||
'database' => function () {
|
|
||||||
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
|
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
|
||||||
'mysql://root:password@localhost:3360/filegator'
|
'mysql://root:password@localhost:3360/filegator'
|
||||||
);
|
);
|
||||||
@@ -56,6 +51,5 @@ For example you can pass ```cookie_lifetime``` parameter to extend default sessi
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@@ -25,12 +25,9 @@ abstract class AuthTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->session = new SessionStorage(new Request());
|
$this->session = new SessionStorage(new Request());
|
||||||
$this->session->init([
|
$this->session->init([
|
||||||
'session_handler' => 'mockfilesession',
|
'handler' => function () {
|
||||||
'available' => [
|
|
||||||
'mockfilesession' => function () {
|
|
||||||
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
||||||
},
|
},
|
||||||
],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->setAuth();
|
$this->setAuth();
|
||||||
|
@@ -25,12 +25,9 @@ class SessionStorageTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->session_service = new SessionStorage(new Request());
|
$this->session_service = new SessionStorage(new Request());
|
||||||
$this->session_service->init([
|
$this->session_service->init([
|
||||||
'session_handler' => 'mockfilesession',
|
'handler' => function () {
|
||||||
'available' => [
|
|
||||||
'mockfilesession' => function () {
|
|
||||||
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
||||||
},
|
},
|
||||||
],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
@@ -28,14 +28,11 @@ return [
|
|||||||
'Filegator\Services\Session\SessionStorageInterface' => [
|
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||||
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
||||||
'config' => [
|
'config' => [
|
||||||
'session_handler' => 'mockfilesession',
|
'handler' => function () {
|
||||||
'available' => [
|
|
||||||
'mockfilesession' => function () {
|
|
||||||
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
return new \Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage();
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
|
||||||
'Filegator\Services\Tmpfs\TmpfsInterface' => [
|
'Filegator\Services\Tmpfs\TmpfsInterface' => [
|
||||||
'handler' => '\Filegator\Services\Tmpfs\Adapters\Tmpfs',
|
'handler' => '\Filegator\Services\Tmpfs\Adapters\Tmpfs',
|
||||||
'config' => [
|
'config' => [
|
||||||
|
Reference in New Issue
Block a user