Ejemplo n.º 1
0
 /**
  * Open the session store
  * 
  * @return bool
  */
 public function open()
 {
     // Make sure storage container exists
     if ($this->_storageType == self::STORAGE_TYPE_TABLE) {
         $this->_storage->createTableIfNotExists($this->_sessionContainer);
     } else {
         if ($this->_storageType == self::STORAGE_TYPE_BLOB) {
             $this->_storage->createContainerIfNotExists($this->_sessionContainer);
         }
     }
     // Ok!
     return true;
 }
Ejemplo n.º 2
0
 /**
  * @see FileBackend::doPrepare()
  */
 function doPrepareInternal($container, $dir, array $params)
 {
     $status = Status::newGood();
     list($c, $dir) = $this->resolveStoragePath($params['dir']);
     if ($dir === null) {
         $status->fatal('backend-fail-invalidpath', $params['dir']);
         return $status;
         // invalid storage path
     }
     try {
         $this->storageClient->createContainerIfNotExists($c);
         $this->storageClient->setContainerAcl($c, Microsoft_WindowsAzure_Storage_Blob::ACL_PUBLIC);
     } catch (Exception $e) {
         $status->fatal('directorycreateerror', $params['dir']);
         return $status;
     }
     return $status;
 }
	/**
	 * @see FileBackend::prepare()
	 */

	function doPrepareInternal( $container, $dir, array $params ) {
		$status = Status::newGood();

		list( $c, $dir ) = $this->resolveStoragePath( $params['dir'] );
		if ( $dir === null ) {
			$status->fatal( 'backend-fail-invalidpath', $params['dir'] );
			return $status; // invalid storage path
		}
		try {
			$this->storageClient->createContainerIfNotExists( $c );
			// TODO: must this be set anytime prepare is called?
			$this->storageClient->setContainerAcl( $c, Microsoft_WindowsAzure_Storage_Blob::ACL_PUBLIC );

			// TODO: check if readable and writeable
			//$container = $this->storageClient->getContainer( $c );
			//$status->fatal( 'directoryreadonlyerror', $params['dir'] );
			//$status->fatal( 'directorynotreadableerror', $params['dir'] );
		}
		catch (Exception $e ) {
			$status->fatal( 'directorycreateerror', $params['dir'] );
			return $status;
		}
		return $status;
	}