diff --git a/CHANGELOG.md b/CHANGELOG.md index a100d969b..3bf9884d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ 1. [](#bugfix) * Fix for base paths containing special characters [#1799](https://github.com/getgrav/grav/issues/1799) * Fix for `vundefined` error for version numbers in GPM [form#222](https://github.com/getgrav/grav-plugin-form/issues/222) +1. [](#improved) + * Added new configuration option `system.session.initialize` to delay session initialization if needed by a plugin # v1.4.0-beta.2 ## 12/18/2017 diff --git a/system/config/system.yaml b/system/config/system.yaml index 72c6bc2ff..1416c92e2 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -132,6 +132,7 @@ media: session: enabled: true # Enable Session support + initialize: true # Initialize session from Grav (if false, plugin needs to start the session) timeout: 1800 # Timeout in seconds name: grav-site # Name prefix of the session cookie. Use alphanumeric, dashes or underscores only. Do not use dots in the session name secure: false # Set session secure. If true, indicates that communication for this cookie must be over an encrypted transmission. Enable this only on sites that run exclusively on HTTPS diff --git a/system/src/Grav/Common/Processors/InitializeProcessor.php b/system/src/Grav/Common/Processors/InitializeProcessor.php index 1b4022735..da4bcee08 100644 --- a/system/src/Grav/Common/Processors/InitializeProcessor.php +++ b/system/src/Grav/Common/Processors/InitializeProcessor.php @@ -31,8 +31,12 @@ class InitializeProcessor extends ProcessorBase implements ProcessorInterface date_default_timezone_set($this->container['config']->get('system.timezone')); } - // Initialize uri, session. - $this->container['session']->init(); + // FIXME: Initialize session should happen later after plugins have been loaded. This is a workaround to fix session issues in AWS. + if ($this->container['config']->get('system.session.initialize', 1)) { + $this->container['session']->init(); + } + + // Initialize uri. $this->container['uri']->init(); $this->container->setLocale();