作者:saj69
项目:pip
protected function setUp()
{
parent::setUp();
$this->bag = new MetadataBag();
$this->array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0);
$this->bag->initialize($this->array);
}
作者:neteasy-wor
项目:hkgbf_cr
public function testDoesNotSkipLastUsedUpdate()
{
$bag = new MetadataBag('', 30);
$timeStamp = time();
$created = $timeStamp - 45;
$sessionMetadata = array(MetadataBag::CREATED => $created, MetadataBag::UPDATED => $created, MetadataBag::LIFETIME => 1000);
$bag->initialize($sessionMetadata);
$this->assertEquals($timeStamp, $sessionMetadata[MetadataBag::UPDATED]);
}
作者:adon98
项目:phpsocket.i
public function clear()
{
if ($this->metadataBag) {
$this->metadataBag->clear();
}
foreach ($this->bags as $bag) {
$bag->clear();
}
}
作者:TheTypoMaste
项目:SPHERE-Framewor
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (!$this->started) {
$this->start();
}
$this->metadataBag->stampNew($lifetime);
$this->id = $this->generateId();
return true;
}
作者:rodionraki
项目:twi
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
if ($destroy) {
$this->metadataBag->stampNew();
}
return session_regenerate_id($destroy);
}
作者:hichammoa
项目:symfon
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
if ($destroy) {
$this->metadataBag->stampNew();
}
$isRegenerated = session_regenerate_id($destroy);
// The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it.
// @see https://bugs.php.net/bug.php?id=70013
$this->loadSession();
return $isRegenerated;
}
作者:atiard
项目:bol
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (!$this->started) {
$this->start();
}
if ($lifetime !== null) {
$this->options['cookie_lifetime'] = $lifetime;
}
if ($destroy) {
$this->metadataBag->stampNew($lifetime);
$this->handler->destroy($this->id);
}
$this->id = $this->generator->generateId();
return true;
}
作者:trangungho
项目:l4cm
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
if ($destroy) {
$this->metadataBag->stampNew();
}
$ret = session_regenerate_id($destroy);
// workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
session_write_close();
$backup = $_SESSION;
session_start();
$_SESSION = $backup;
return $ret;
}
作者:robbert-vd
项目:bol
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (!$this->started) {
$this->start();
}
if ($lifetime !== null) {
$this->options['cookie_lifetime'] = $lifetime;
}
if ($destroy) {
$this->metadataBag->stampNew($lifetime);
$this->handler->destroy($this->id);
} else {
$this->write();
}
$this->handler->close();
$this->id = $this->generator->generateId();
$this->handler->open(null, $this->name);
// read is required to make new session data at this point
$this->handler->read($this->id);
return true;
}
作者:qasem2rubi
项目:larave
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
// Cannot regenerate the session ID for non-active sessions.
if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE !== session_status()) {
return false;
}
// Check if session ID exists in PHP 5.3
if (PHP_VERSION_ID < 50400 && '' === session_id()) {
return false;
}
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
if ($destroy) {
$this->metadataBag->stampNew();
}
$isRegenerated = session_regenerate_id($destroy);
// The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it.
// @see https://bugs.php.net/bug.php?id=70013
$this->loadSession();
return $isRegenerated;
}
作者:senthil-r-wiredelt
项目:meilleure-visit
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
if ($destroy) {
$this->metadataBag->stampNew();
}
$ret = session_regenerate_id($destroy);
// workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
if ('files' === $this->getSaveHandler()->getSaveHandlerName()) {
session_write_close();
if (isset($_SESSION)) {
$backup = $_SESSION;
session_start();
$_SESSION = $backup;
} else {
session_start();
}
$this->loadSession();
}
return $ret;
}
作者:laubosslin
项目:la
public function testClear()
{
$this->bag->clear();
}
作者:eigento
项目:tommiblo
/**
* Constructs a new metadata bag instance.
*
* @param \Drupal\Core\Site\Settings $settings
* The settings instance.
*/
public function __construct(Settings $settings)
{
$update_threshold = $settings->get('session_write_interval', 180);
parent::__construct('_sf2_meta', $update_threshold);
}