/usr/local/vufind/module/VuFind/src/VuFind/Session/File.php
                  
                    -         foreach (glob($this->getPath() . "/sess_*") as $filename) {
 -             if (filemtime($filename) + $maxlifetime < time()) {
 -                 unlink($filename);
 -             }
 -         }
 -         return true;
 -     }
 -  
 -     /**
 -      * A function that is called internally when session data is to be saved.
 -      *
 -      * @param string $sess_id The current session ID
 -      * @param string $data    The session data to write
 -      *
 -      * @return bool
 -      */
 -     protected function saveSession($sess_id, $data)
 -     {
 -         $sess_file = $this->getPath() . '/sess_' . $sess_id;
 -         if ($fp = fopen($sess_file, "w")) {
 -             $return = fwrite($fp, $data);
 -             fclose($fp);
 -             if ($return !== false) {
 -                 return true;
 -             }
 -         }
 -         // If we got this far, something went wrong with the file output...
 -         // It is tempting to throw an exception here, but this code is called
 -         // outside of the context of exception handling, so all we can do is
 -         // echo a message.
 -         echo 'Cannot write session to ' . $sess_file . "\n";
 -         return false;
 -     }
 - }
 -  
 
                  
                
                
       
            
        
                                /usr/local/vufind/module/VuFind/src/VuFind/Session/File.php
                  
                            foreach (glob($this->getPath() . "/sess_*") as $filename) {
            if (filemtime($filename) + $maxlifetime < time()) {
                unlink($filename);
            }
        }
        return true;
    }
 
    /**
     * A function that is called internally when session data is to be saved.
     *
     * @param string $sess_id The current session ID
     * @param string $data    The session data to write
     *
     * @return bool
     */
    protected function saveSession($sess_id, $data)
    {
        $sess_file = $this->getPath() . '/sess_' . $sess_id;
        if ($fp = fopen($sess_file, "w")) {
            $return = fwrite($fp, $data);
            fclose($fp);
            if ($return !== false) {
                return true;
            }
        }
        // If we got this far, something went wrong with the file output...
        // It is tempting to throw an exception here, but this code is called
        // outside of the context of exception handling, so all we can do is
        // echo a message.
        echo 'Cannot write session to ' . $sess_file . "\n";
        return false;
    }
}
 
                  
                
                
       
            
        
                                /usr/local/vufind/module/VuFind/src/VuFind/Session/AbstractBase.php
                  
                            // Anecdotal testing Today and Yesterday seems to indicate destroy()
        //   is called by the garbage collector and everything is good.
        // Something to keep in mind though.
        return true;
    }
 
    /**
     * Write function that is called when session data is to be saved.
     *
     * @param string $sess_id The current session ID
     * @param string $data    The session data to write
     *
     * @return bool
     */
    public function write($sess_id, $data)
    {
        if ($this->writesDisabled) {
            return true;
        }
        return $this->saveSession($sess_id, $data);
    }
 
    /**
     * A function that is called internally when session data is to be saved.
     *
     * @param string $sess_id The current session ID
     * @param string $data    The session data to write
     *
     * @return bool
     */
    abstract protected function saveSession($sess_id, $data);
}
 
                  
                
                
       
            
            
        
                                /usr/local/vufind/vendor/zendframework/zend-session/src/SessionManager.php
                  
                         *
     * @return void
     */
    public function writeClose()
    {
        // The assumption is that we're using PHP's ext/session.
        // session_write_close() will actually overwrite $_SESSION with an
        // empty array on completion -- which leads to a mismatch between what
        // is in the storage object and $_SESSION. To get around this, we
        // temporarily reset $_SESSION to an array, and then re-link it to
        // the storage object.
        //
        // Additionally, while you _can_ write to $_SESSION following a
        // session_write_close() operation, no changes made to it will be
        // flushed to the session handler. As such, we now mark the storage
        // object isImmutable.
        $storage  = $this->getStorage();
        if (! $storage->isImmutable()) {
            $_SESSION = $storage->toArray(true);
            session_write_close();
            $storage->fromArray($_SESSION);
            $storage->markImmutable();
        }
    }
 
    /**
     * Attempt to set the session name
     *
     * If the session has already been started, or if the name provided fails
     * validation, an exception will be raised.
     *
     * @param  string $name
     * @return SessionManager
     * @throws Exception\InvalidArgumentException
     */
    public function setName($name)
    {
        if ($this->sessionExists()) {
            throw new Exception\InvalidArgumentException(
                'Cannot set session name after a session has already started'