diff --git a/app/config/config.yml b/app/config/config.yml index ba6ace5db..4b1c2a604 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -332,9 +332,8 @@ framework: default_locale: "%locale%" trusted_hosts: ~ session: - # http://symfony.com/doc/current/reference/configuration/framework.html#handler-id - storage_id: session.storage.php_bridge - handler_id: ~ + # https://symfony.com/doc/4.x/session/database.html#store-sessions-in-a-relational-database-mariadb-mysql-postgresql + handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler fragments: ~ http_method_override: true assets: ~ diff --git a/app/config/services.yml b/app/config/services.yml index a7f4ed75e..2f1dcec09 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -14,6 +14,15 @@ services: _defaults: public: true + Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler: + public: false + arguments: + - 'mysql:host=%database_host%;port=%database_port%;dbname=%database_name%' + - db_username: '%database_user%' + db_password: '%database_password%' + lock_mode: !php/const:Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler::LOCK_NONE + + AppBundle\Controller\Event\: resource: '../../sources/AppBundle/Controller/Event/*' autowire: true diff --git a/db/migrations/20240106213200_sessions.php b/db/migrations/20240106213200_sessions.php new file mode 100644 index 000000000..573670a9d --- /dev/null +++ b/db/migrations/20240106213200_sessions.php @@ -0,0 +1,20 @@ +execute($sql); + } +} diff --git a/htdocs/app.php b/htdocs/app.php index 0f8f3d655..db685d027 100644 --- a/htdocs/app.php +++ b/htdocs/app.php @@ -19,8 +19,6 @@ exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } - session_start(); - /** @var \Composer\Autoload\ClassLoader $loader */ $loader = require __DIR__.'/../vendor/autoload.php'; Debug::enable(); @@ -34,8 +32,6 @@ /** @var \Composer\Autoload\ClassLoader $loader */ $loader = require __DIR__.'/../vendor/autoload.php'; - session_start(); - $kernel = new AppKernel('prod', false); } diff --git a/htdocs/include/prepend.inc.php b/htdocs/include/prepend.inc.php index ef8c2170a..09206b26e 100644 --- a/htdocs/include/prepend.inc.php +++ b/htdocs/include/prepend.inc.php @@ -3,8 +3,6 @@ // Initialisation ob_start(); -session_start(); - // Inclusion de l'autoload de composer require_once dirname(__FILE__) . '/../../vendor/autoload.php'; diff --git a/htdocs/pages/planete/app.php b/htdocs/pages/planete/app.php index 4169d0a70..ccee78e7c 100644 --- a/htdocs/pages/planete/app.php +++ b/htdocs/pages/planete/app.php @@ -28,8 +28,6 @@ exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } - session_start(); - /** @var ClassLoader $loader */ $loader = require __DIR__.'/../../../vendor/autoload.php'; Debug::enable(); @@ -43,8 +41,6 @@ /** @var ClassLoader $loader */ $loader = require __DIR__.'/../../../vendor/autoload.php'; - session_start(); - $kernel = new PlaneteAppKernel('prod', false); }