Archived
1
0
Fork 0

app/library/Services.php: add config for session.

This commit is contained in:
Henrik Hautakoski 2018-08-08 16:50:28 +02:00
parent aa07255891
commit a2ea4f54e0
No known key found for this signature in database
GPG key ID: 839F3A7EAFAEAFAA

View file

@ -187,15 +187,25 @@ class Services extends DiDefault
{
$config = $this->get('config');
// Set session directory if defined.
if (isset($config->application->sessionDir)) {
session_save_path($config->application->sessionDir);
if (isset($config->session)) {
$data = $config->session->toArray();
$adapter = $data['adapter'];
$options = $data['options'];
$class = 'Phalcon\Session\Adapter\\' . $adapter;
$session = new $class($options);
}
// Default to File storage
else {
// Set session directory if defined.
if (isset($config->application->sessionDir)) {
session_save_path($config->application->sessionDir);
}
$session = new SessionAdapter();
}
// Create and start session.
$session = new SessionAdapter();
// Start session.
$session->start();
return $session;
}