diff --git a/administrator/components/com_config/model/form/application.xml b/administrator/components/com_config/model/form/application.xml index 2f965fe43d503..31feccd831b64 100644 --- a/administrator/components/com_config/model/form/application.xml +++ b/administrator/components/com_config/model/form/application.xml @@ -924,6 +924,31 @@ size="5" /> + + + + _server = array( + 'host' => $config->get('session_redis_server_host', 'localhost'), + 'port' => $config->get('session_redis_server_port', 6379), + ); + + parent::__construct($options); + } + + /** + * Register the functions of this class with PHP's session handler + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function register() + { + if (!empty($this->_server) && isset($this->_server['host']) && isset($this->_server['port'])) + { + ini_set('session.save_path', "{$this->_server['host']}:{$this->_server['port']}"); + ini_set('session.save_handler', 'redis'); + + // This is required if the configuration.php gzip is turned on + ini_set('zlib.output_compression', 'Off'); + } + } + + /** + * Test to see if the SessionHandler is available. + * + * @return boolean True on success, false otherwise. + * + * @since __DEPLOY_VERSION__ + */ + public static function isSupported() + { + return extension_loaded('redis') && class_exists('Redis'); + } +}