Source of file BaseStore.php
Size: 1,222 Bytes - Last Modified: 2021-12-23T10:32:34+00:00
/var/www/docs.ssmods.com/process/src/src/Store/BaseStore.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 | <?php namespace SilverStripe\HybridSessions\Store; use SessionHandlerInterface; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\Core\Config\Configurable; abstract class BaseStore implements SessionHandlerInterface { use Configurable; /** * Session secret key * * @var string */ protected $key = null; /** * Assign a new session secret key * * @param string $key */ public function setKey($key) { $this->key = $key; } /** * Get the session secret key * * @return string */ protected function getKey() { return $this->key; } /** * Get lifetime in number of seconds * * @return int */ protected function getLifetime() { $params = session_get_cookie_params(); $cookieLifetime = (int)$params['lifetime']; $gcLifetime = (int)ini_get('session.gc_maxlifetime'); return $cookieLifetime ? min($cookieLifetime, $gcLifetime) : $gcLifetime; } /** * Gets the current unix timestamp * * @return int */ protected function getNow() { return (int) DBDatetime::now()->getTimestamp(); } } |