Exemplo n.º 1
0
 /**
  * Store an item in the storage service.
  *
  * WARNING: This operation overwrites any item that is located at
  * $destinationPath.
  *
  * @TODO Support streams
  *
  * @param string $destinationPath
  * @param string|resource $data
  * @param  array $options
  * @return void
  */
 public function storeItem($destinationPath, $data, $options = array())
 {
     try {
         $fullPath = $this->_getFullPath($destinationPath, $options);
         return $this->_s3->putObject($fullPath, $data, empty($options[self::METADATA]) ? null : $options[self::METADATA]);
     } catch (\ZendService\Amazon\S3\Exception $e) {
         throw new Exception\RuntimeException('Error on store: ' . $e->getMessage(), $e->getCode(), $e);
     }
 }
Exemplo n.º 2
0
 /**
  * Flush current cached stream data to storage
  *
  * @return boolean
  */
 public function stream_flush()
 {
     // If the stream wasn't opened for writing, just return false
     if (!$this->_writeBuffer) {
         return false;
     }
     $ret = $this->_s3->putObject($this->_objectName, $this->_objectBuffer);
     $this->_objectBuffer = null;
     return $ret;
 }