Esempio n. 1
0
 /**
  * Garbage collector method
  *
  * This is executed when the session garbage collector is executed and takes
  * the max session lifetime as its only parameter
  *
  * @param int $lifetime max session lifetime in seconds
  *
  * @return bool
  */
 public function clean($lifetime)
 {
     $sessions = AeDirectory::getInstance($this->_storagePath);
     $expired = time() - $lifetime;
     foreach ($sessions as $session) {
         if (!$session->isFile() || $session->extension != $this->_extension) {
             continue;
         }
         if ($session->modifiedTime < $expired) {
             $session->delete();
         }
     }
     return true;
 }
Esempio n. 2
0
 /**
  * Read next value
  *
  * This method is called after each internal array pointer movement. Methods
  * like {@link AeDirectory_Iterator::next() next()} and {@link
  * AeDirectory_Iterator::rewind() rewind()} use it to verify if the current
  * value exists. The {@link AeDirectory_Iterator::valid() valid()} method
  * only works with the results, this method provides.
  *
  * @return mixed current element key or null, if end of array was reached
  */
 protected function _readNext()
 {
     $dh = $this->_directory->getHandle();
     do {
         $current = @readdir($dh);
     } while ($current == '.' || $current == '..');
     if ($current === false) {
         $this->_current = null;
         $this->_key = null;
         return null;
     }
     $this->_current = $current;
     if ($this->_key === null) {
         $this->_key = 0;
     } else {
         $this->_key++;
     }
     return $this->_key;
 }
Esempio n. 3
0
 public function getParent()
 {
     return AeDirectory::getInstance(dirname($this->path));
 }