Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /joomla/environment/sessionstorage/eaccelerator.php

Documentation is available at eaccelerator.php

  1. <?php
  2. /**
  3. @version        $Id: session.php 6157 2007-01-03 00:22:09Z Jinx $
  4. @package        Joomla.Framework
  5. @subpackage    Environment
  6. @copyright    Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
  7. @license        GNU/GPL, see LICENSE.php
  8. *  Joomla! is free software. This version may have been modified pursuant
  9. *  to the GNU General Public License, and as distributed it includes or
  10. *  is derivative of works licensed under the GNU General Public License or
  11. *  other free or open source software licenses.
  12. *  See COPYRIGHT.php for copyright notices and details.
  13. */
  14.  
  15. // Check to ensure this file is within the rest of the framework
  16. defined('JPATH_BASE'or die();
  17.  
  18. /**
  19. * eAccelerator session storage handler for PHP
  20. *
  21. @author        Johan Janssens <[email protected]>
  22. @package        Joomla.Framework
  23. @subpackage    Environment
  24. @since        1.5
  25. @see http://www.php.net/manual/en/function.session-set-save-handler.php
  26. */
  27. {
  28.     /**
  29.     * Constructor
  30.     *
  31.     * @access protected
  32.     * @param array $options optional parameters
  33.     */
  34.     function __construct$options array() )
  35.     {
  36.         if (!$this->test()) {
  37.             return JError::raiseError(404"The eaccelerator extension isn't available");
  38.         }
  39.  
  40.         parent::__construct($options);
  41.     }
  42.  
  43.     /**
  44.      * Open the SessionHandler backend.
  45.      *
  46.      * @access public
  47.      * @param string $save_path     The path to the session object.
  48.      * @param string $session_name  The name of the session.
  49.      * @return boolean  True on success, false otherwise.
  50.      */
  51.     function open($save_path$session_name)
  52.     {
  53.         return true;
  54.     }
  55.  
  56.     /**
  57.      * Close the SessionHandler backend.
  58.      *
  59.      * @access public
  60.      * @return boolean  True on success, false otherwise.
  61.      */
  62.     function close()
  63.     {
  64.         return true;
  65.     }
  66.  
  67.      /**
  68.       * Read the data for a particular session identifier from the
  69.       * SessionHandler backend.
  70.       *
  71.       * @access public
  72.       * @param string $id  The session identifier.
  73.       * @return string  The session data.
  74.       */
  75.     function read($id)
  76.     {
  77.         $sess_id 'sess_'.$id;
  78.         return (string) eaccelerator_get($sess_id);
  79.     }
  80.  
  81.     /**
  82.      * Write session data to the SessionHandler backend.
  83.      *
  84.      * @access public
  85.      * @param string $id            The session identifier.
  86.      * @param string $session_data  The session data.
  87.      * @return boolean  True on success, false otherwise.
  88.      */
  89.     function write($id$session_data)
  90.     {
  91.         $sess_id 'sess_'.$id;
  92.         return eaccelerator_put($sess_id$session_dataini_get("session.gc_maxlifetime"));
  93.     }
  94.  
  95.     /**
  96.       * Destroy the data for a particular session identifier in the
  97.       * SessionHandler backend.
  98.       *
  99.       * @access public
  100.       * @param string $id  The session identifier.
  101.       * @return boolean  True on success, false otherwise.
  102.       */
  103.     function destroy($id)
  104.     {
  105.         $sess_id 'sess_'.$id;
  106.         return eaccelerator_rm($sess_id);
  107.     }
  108.  
  109.     /**
  110.      * Garbage collect stale sessions from the SessionHandler backend.
  111.      *
  112.      * @access public
  113.      * @param integer $maxlifetime  The maximum age of a session.
  114.      * @return boolean  True on success, false otherwise.
  115.      */
  116.     function gc($maxlifetime)
  117.     {
  118.         eaccelerator_gc();
  119.         return true;
  120.     }
  121.  
  122.     /**
  123.      * Test to see if the SessionHandler is available.
  124.      *
  125.      * @static
  126.      * @access public
  127.      * @return boolean  True on success, false otherwise.
  128.      */
  129.     function test({
  130.         return (extension_loaded('eaccelerator'&& function_exists('eaccelerator_get'));
  131.     }
  132. }
  133. ?>

Documentation generated on Mon, 05 Mar 2007 20:56:57 +0000 by phpDocumentor 1.3.1