コード例 #1
0
 public function init($lt)
 {
     global $configArray;
     // Set defaults if nothing set in config file.
     self::$path = isset($configArray['Session']['file_save_path']) ? $configArray['Session']['file_save_path'] : '/tmp/vufind_sessions';
     // Die if the session directory does not exist and cannot be created.
     if (!file_exists(self::$path) || !is_dir(self::$path)) {
         if (!@mkdir(self::$path)) {
             PEAR_Singleton::raiseError(new PEAR_Error("Cannot access session save path: " . self::$path));
         }
     }
     // Call standard session initialization from this point.
     parent::init($lt);
 }
コード例 #2
0
 public function init($lt, $rememberMeLifetime)
 {
     global $configArray;
     // Set defaults if nothing set in config file.
     $host = isset($configArray['Session']['memcache_host']) ? $configArray['Session']['memcache_host'] : 'localhost';
     $port = isset($configArray['Session']['memcache_port']) ? $configArray['Session']['memcache_port'] : 11211;
     $timeout = isset($configArray['Session']['memcache_connection_timeout']) ? $configArray['Session']['memcache_connection_timeout'] : 1;
     // Connect to Memcache:
     self::$connection = new Memcache();
     if (!@self::$connection->connect($host, $port, $timeout)) {
         PEAR_Singleton::raiseError(new PEAR_Error("Could not connect to Memcache (host = {$host}, port = {$port})."));
     }
     // Call standard session initialization from this point.
     parent::init($lt, $rememberMeLifetime);
 }
コード例 #3
0
ファイル: FileSession.php プロジェクト: bharatm/NDL-VuFind
 /**
  * Initialize the session handler.
  *
  * @param int $lt Session lifetime (in seconds)
  *
  * @return void
  * @access public
  */
 public function init($lt)
 {
     global $configArray;
     // Set defaults if nothing set in config file.
     if (isset($configArray['Session']['file_save_path'])) {
         self::$_path = $configArray['Session']['file_save_path'];
     } else {
         // Some versions of PHP 5.2 do not have sys_get_temp_dir(), so we'll
         // make a best guess if we have to.
         $tempdir = function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : DIRECTORY_SEPARATOR . 'tmp';
         self::$_path = $tempdir . DIRECTORY_SEPARATOR . 'vufind_sessions';
     }
     // Die if the session directory does not exist and cannot be created.
     if (!file_exists(self::$_path) || !is_dir(self::$_path)) {
         if (!@mkdir(self::$_path)) {
             PEAR::raiseError(new PEAR_Error("Cannot access session save path: " . self::$_path));
         }
     }
     // Call standard session initialization from this point.
     parent::init($lt);
 }