[FrameworkBundle] Make session save path configurable
This commit is contained in:
parent
114bc14c21
commit
c0e7ee9a6c
|
@ -181,6 +181,7 @@ class Configuration implements ConfigurationInterface
|
|||
->scalarNode('gc_divisor')->end()
|
||||
->scalarNode('gc_probability')->end()
|
||||
->scalarNode('gc_maxlifetime')->end()
|
||||
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
|
||||
->scalarNode('lifetime')->setInfo('DEPRECATED! Please use: cookie_lifetime')->end()
|
||||
->scalarNode('path')->setInfo('DEPRECATED! Please use: cookie_path')->end()
|
||||
->scalarNode('domain')->setInfo('DEPRECATED! Please use: cookie_domain')->end()
|
||||
|
|
|
@ -313,6 +313,8 @@ class FrameworkExtension extends Extension
|
|||
// session handler (the internal callback registered with PHP session management)
|
||||
$container->setAlias('session.handler', $config['handler_id']);
|
||||
|
||||
$container->setParameter('session.save_path', $config['save_path']);
|
||||
|
||||
$this->addClassesToCompile(array(
|
||||
'Symfony\\Bundle\\FrameworkBundle\\EventListener\\SessionListener',
|
||||
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface',
|
||||
|
|
|
@ -89,6 +89,7 @@
|
|||
<xsd:attribute name="gc-maxlifetime" type="xsd:string" />
|
||||
<xsd:attribute name="gc-divisor" type="xsd:string" />
|
||||
<xsd:attribute name="gc-probability" type="xsd:string" />
|
||||
<xsd:attribute name="save-path" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="templating">
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</service>
|
||||
|
||||
<service id="session.handler.native_file" class="%session.handler.native_file.class%" public="false">
|
||||
<argument>%kernel.cache_dir%/sessions</argument>
|
||||
<argument>%session.save_path%</argument>
|
||||
</service>
|
||||
|
||||
<service id="session_listener" class="%session_listener.class%">
|
||||
|
|
|
@ -31,6 +31,7 @@ $container->loadFromExtension('framework', array(
|
|||
'gc_maxlifetime' => 90000,
|
||||
'gc_divisor' => 108,
|
||||
'gc_probability' => 1,
|
||||
'save_path' => '/path/to/sessions',
|
||||
),
|
||||
'templating' => array(
|
||||
'assets_version' => 'SomeVersionScheme',
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<framework:esi enabled="true" />
|
||||
<framework:profiler only-exceptions="true" />
|
||||
<framework:router resource="%kernel.root_dir%/config/routing.xml" type="xml" />
|
||||
<framework:session auto-start="true" gc-maxlifetime="90000" gc-probability="1" gc-divisor="108" storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="true" />
|
||||
<framework:session auto-start="true" gc-maxlifetime="90000" gc-probability="1" gc-divisor="108" storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="true" save-path="/path/to/sessions" />
|
||||
<framework:templating assets-version="SomeVersionScheme" cache="/path/to/cache" >
|
||||
<framework:loader>loader.foo</framework:loader>
|
||||
<framework:loader>loader.bar</framework:loader>
|
||||
|
|
|
@ -25,6 +25,7 @@ framework:
|
|||
gc_probability: 1
|
||||
gc_divisor: 108
|
||||
gc_maxlifetime: 90000
|
||||
save_path: /path/to/sessions
|
||||
templating:
|
||||
assets_version: SomeVersionScheme
|
||||
assets_base_urls: http://cdn.example.com
|
||||
|
|
|
@ -91,6 +91,8 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||
$this->assertEquals(108, $options['gc_divisor']);
|
||||
$this->assertEquals(1, $options['gc_probability']);
|
||||
$this->assertEquals(90000, $options['gc_maxlifetime']);
|
||||
|
||||
$this->assertEquals('/path/to/sessions', $container->getParameter('session.save_path'));
|
||||
}
|
||||
|
||||
public function testSessionDeprecatedMergeFull()
|
||||
|
|
Reference in New Issue