コード例 #1
0
ファイル: RackspaceAdapter.php プロジェクト: jiiis/ptn
 /**
  * {@inheritdoc}
  */
 public function write($path, $contents, Config $config)
 {
     $location = $this->applyPathPrefix($path);
     $headers = [];
     if ($config && $config->has('headers')) {
         $headers = $config->get('headers');
     }
     $response = $this->container->uploadObject($location, $contents, $headers);
     return $this->normalizeObject($response);
 }
コード例 #2
0
ファイル: DataObject.php プロジェクト: isrealconsulting/site
 public function update($params = array())
 {
     $metadata = self::stockHeaders($this->metadata->toArray());
     // merge specific properties with metadata
     $metadata += array(HeaderConst::CONTENT_TYPE => $this->contentType, HeaderConst::LAST_MODIFIED => $this->lastModified, HeaderConst::CONTENT_LENGTH => $this->contentLength, HeaderConst::ETAG => $this->etag);
     return $this->container->uploadObject($this->name, $this->content, $metadata);
 }
コード例 #3
0
ファイル: swift.php プロジェクト: pinoniq/core
 public function writeBack($tmpFile)
 {
     if (!isset(self::$tmpFiles[$tmpFile])) {
         return false;
     }
     $fileData = fopen($tmpFile, 'r');
     $this->container->uploadObject(self::$tmpFiles[$tmpFile], $fileData);
     unlink($tmpFile);
 }
コード例 #4
0
ファイル: OpenCloud.php プロジェクト: piflex/FilesystemBundle
 public function mkdir($name, $recursive = true)
 {
     $dirs = [];
     if ($recursive) {
         $dirs = explode('/', $name);
     }
     $name = null;
     foreach ($dirs as $dir) {
         $name = $name ? $name . '/' . $dir : $dir;
         if (!$this->tryGetObject($name)) {
             $this->container->uploadObject($name, '', [Header::CONTENT_TYPE => self::CONTENT_TYPE_HEADER_DIRECTORY]);
         }
     }
     return true;
 }
コード例 #5
0
ファイル: Rackspace.php プロジェクト: yakamoz-fang/concrete
 /**
  * Write a file
  *
  * @param   string  $path
  * @param   string  $contents
  * @param   mixed   $config
  * @return  array   file metadata
  */
 public function write($path, $contents, $config = null)
 {
     $location = $this->prefix($path);
     $response = $this->container->uploadObject($location, $contents);
     return $this->normalizeObject($response);
 }
コード例 #6
0
ファイル: swift.php プロジェクト: mnefedov/core
 /**
  * @param string $urn the unified resource name used to identify the object
  * @param resource $stream stream with the data to write
  * @throws Exception from openstack lib when something goes wrong
  */
 public function writeObject($urn, $stream)
 {
     $this->init();
     $this->container->uploadObject($urn, $stream);
 }
コード例 #7
0
 public function uploadFontFiles(Container $container, $fileType, $output)
 {
     $output->writeln(sprintf("<info> Uploading </info><comment> %s </comment><info> Files </info>", $fileType));
     $finder = new Finder();
     $finder->files()->in($this->getContainer()->getParameter("kernel.root_dir") . "/../web/bundles")->name(sprintf("*.%s", $fileType));
     $contentType = $this->getContentType($fileType);
     foreach ($finder as $file) {
         $uploaded = false;
         $tryes = 0;
         while (!$uploaded && $tryes < 5) {
             try {
                 $tryes++;
                 /** @var SplFileInfo $file */
                 $container->uploadObject(sprintf("bundles/%s", $file->getRelativePathname()), file_get_contents($file->getRealPath()), ["Access-Control-Allow-Origin" => "*", "Content-Type" => $contentType]);
                 $uploaded = true;
                 $output->writeln(sprintf("<info> Uploaded </info><comment> %s </comment><info> File </info>", $file->getRelativePathname()));
             } catch (\Exception $e) {
                 if ($tryes >= 5) {
                     $output->writeln(sprintf("<error>Guzzle Returned ServerErrorResponseException - Cancelled Upload </error>"));
                     throw $e;
                 }
                 $output->writeln(sprintf("<error>Guzzle ServerErrorResponseException We will try again in 5 seconds</error>"));
                 sleep(5);
             }
         }
     }
 }
コード例 #8
0
ファイル: DataObject.php プロジェクト: fandikurnia/CiiMS
 public function update($params = array())
 {
     return $this->container->uploadObject($this->name, $this->content, $this->metadata->toArray());
 }