- md5
- 8791fa341f66c62416b5ea9e8b257947
- sha1
- 4a6088b3b0d97bf28e372b88556ae3b14c5e4427
- sha256
- f8d47978e30a33f2c2d7404e1be4918958d493c0f950375cf7b0e44e8001a932
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
<?php
/**
* @package Joomla.Installation
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Installation\Service\Provider;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Session\Storage\JoomlaStorage;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Session\Handler\FilesystemHandler;
use Joomla\Session\Validator\AddressValidator;
use Joomla\Session\Validator\ForwardedValidator;
/**
* Service provider for the application's session dependency
*
* @since 4.0
*/
class Session implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.0
*/
public function register(Container $container)
{
$container->alias('session', 'Joomla\Session\SessionInterface')
->alias('JSession', 'Joomla\Session\SessionInterface')
->alias('Joomla\Session\Session', 'Joomla\Session\SessionInterface')
->share(
'Joomla\Session\SessionInterface',
function (Container $container)
{
$app = Factory::getApplication();
// Initialize the options for the Session object.
$options = array(
'name' => md5(get_class($app)),
'expire' => 900
);
// Set up the storage handler
$handler = new FilesystemHandler(JPATH_INSTALLATION . '/sessions');
$input = $app->input;
$storage = new JoomlaStorage($input, $handler);
$dispatcher = $container->get('Joomla\Event\DispatcherInterface');
$dispatcher->addListener('onAfterSessionStart', array($app, 'afterSessionStart'));
$session = new \Joomla\CMS\Session\Session($storage, $dispatcher, $options);
$session->addValidator(new AddressValidator($input, $session));
$session->addValidator(new ForwardedValidator($input, $session));
return $session;
},
true
);
}
}
No other release has this exact content. See every version of this file.