Пример #1
0
 /**
  * Check whether file exists.
  *
  * @param string $file
  * @return boolean
  */
 public function objectExists($file, $container = false)
 {
     if (!$container) {
         $container = $this->getGeneralContainer();
     }
     $obj = $this->_service->getMetadataObject($container, $file);
     if (!$obj) {
         return false;
     }
     return true;
 }
Пример #2
0
 /**
  * Get the metadata of the object
  * If you don't pass the $key it returns the entire array of metadata value
  *
  * @param  string $key
  * @return string|array|boolean
  */
 public function getMetadata($key = null)
 {
     $result = $this->service->getMetadataObject($this->container, $this->name);
     if (!empty($result)) {
         if (empty($key)) {
             return $result['metadata'];
         }
         if (isset($result['metadata'][$key])) {
             return $result['metadata'][$key];
         }
     }
     return false;
 }
Пример #3
0
 /**
  * Get a key/value array of metadata for the given path.
  *
  * @param  string $path
  * @param  array $options
  * @return array An associative array of key/value pairs specifying the metadata for this object.
  *                  If no metadata exists, an empty array is returned.
  */
 public function fetchMetadata($path, $options = null)
 {
     $result = $this->_rackspace->getMetadataObject($this->_container, $path);
     if (!$this->_rackspace->isSuccessful()) {
         throw new Zend_Cloud_StorageService_Exception('Error on fetch metadata: ' . $this->_rackspace->getErrorMsg());
     }
     $metadata = array();
     if (isset($result['metadata'])) {
         $metadata = $result['metadata'];
     }
     // delete the self::DELETE_METADATA_KEY - this is a trick to remove all
     // the metadata information of an object (see deleteMetadata).
     // Rackspace doesn't have an API to remove the metadata of an object
     unset($metadata[self::DELETE_METADATA_KEY]);
     return $metadata;
 }
Пример #4
0
 public function testGetMetadataObject()
 {
     $data = $this->rackspace->getMetadataObject(TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME, TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME);
     $this->assertTrue($data !== false);
     $this->assertEquals($data['metadata'], $this->metadata2);
 }
Пример #5
0
 public function testGetMetadataObject()
 {
     $data = $this->rackspace->getMetadataObject('zf-unit-test', 'zf-object-test');
     $this->assertTrue($data !== false);
     $this->assertEquals($data['metadata'], $this->metadata2);
 }