コード例 #1
0
 /**
  * @runInSeparateProcess
  */
 public function testStaticSessionId()
 {
     $context = AgaviContext::getInstance('agavi-session-storage-test::tests-static-session-id');
     $storage = new AgaviSessionStorage();
     $storage->initialize($context);
     $storage->startup();
     $this->assertEquals(session_id(), 'foobar');
 }
コード例 #2
0
 public function initialize(AgaviContext $context, array $parameters = array())
 {
     // initialize the parent
     parent::initialize($context, $parameters);
     $this->host = isset($parameters["host"]) ? $parameters["host"] : 'localhost';
     $this->port = isset($parameters["port"]) ? $parameters["port"] : 11211;
     session_set_save_handler(array(&$this, 'sessionOpen'), array(&$this, 'sessionClose'), array(&$this, 'sessionRead'), array(&$this, 'sessionWrite'), array(&$this, 'sessionDestroy'), array(&$this, 'sessionGC'));
 }
コード例 #3
0
 /**
  * Initialize this Storage.
  *
  * @param      AgaviContext An AgaviContext instance.
  * @param      array        An associative array of initialization parameters.
  *
  * @throws     <b>AgaviInitializationException</b> If an error occurs while
  *                                                 initializing this Storage.
  *
  * @author     Sean Kerr <*****@*****.**>
  * @author     Veikko Mäkinen <*****@*****.**>
  * @since      0.10.0
  */
 public function initialize(AgaviContext $context, array $parameters = array())
 {
     // initialize the parent
     parent::initialize($context, $parameters);
     if (!$this->hasParameter('db_table')) {
         // missing required 'db_table' parameter
         $error = 'Factory configuration file is missing required "db_table" parameter for the Storage category';
         throw new AgaviInitializationException($error);
     }
     // use this object as the session handler
     session_set_save_handler(array($this, 'sessionOpen'), array($this, 'sessionClose'), array($this, 'sessionRead'), array($this, 'sessionWrite'), array($this, 'sessionDestroy'), array($this, 'sessionGC'));
 }
コード例 #4
0
 /**
  * Initialize this Storage.
  *
  * @param      AgaviContext An AgaviContext instance.
  * @param      array        An associative array of initialization parameters.
  *
  * @throws     <b>AgaviInitializationException</b> If an error occurs while
  *                                                 initializing this Storage.
  *
  * @author     David Zülke <david.zuelke@bitextender.com
  * @since      1.0.4
  */
 public function initialize(AgaviContext $context, array $parameters = array())
 {
     // initialize the parent
     parent::initialize($context, $parameters);
     if (!class_exists('Microsoft_WindowsAzure_SessionHandler')) {
         require 'Microsoft/WindowsAzure/SessionHandler.php';
     }
     $table = new Microsoft_WindowsAzure_Storage_Table($this->getParameter('host', Microsoft_WindowsAzure_Storage::URL_DEV_TABLE), $this->getParameter('account_name', Microsoft_WindowsAzure_Credentials::DEVSTORE_ACCOUNT), $this->getParameter('account_key', Microsoft_WindowsAzure_Credentials::DEVSTORE_KEY));
     $sessionHandler = new Microsoft_WindowsAzure_SessionHandler($table, $this->getParameter('session_table', 'phpsessions'), $this->getParameter('session_table_partition', 'sessions'));
     // this will do session_set_save_handler
     $sessionHandler->register();
 }
コード例 #5
0
 public function initialize(AgaviContext $context, array $parameters = array())
 {
     // initialize the parent
     parent::initialize($context, $parameters);
     session_set_save_handler(array(&$this, 'sessionOpen'), array(&$this, 'sessionClose'), array(&$this, 'sessionRead'), array(&$this, 'sessionWrite'), array(&$this, 'sessionDestroy'), array(&$this, 'sessionGC'));
 }