Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function copy(BucketInterface $bucket, BucketInterface $destination, $name)
 {
     if ($bucket->getOption('region') != $destination->getOption('region')) {
         $this->logger()->warning("Copying between regions are not allowed by Rackspace and performed using local buffer.");
         //Using local memory/disk as buffer
         return parent::copy($bucket, $destination, $name);
     }
     try {
         $request = $this->buildRequest('PUT', $destination, $name, ['X-Copy-From' => '/' . $bucket->getOPtion('container') . '/' . rawurlencode($name), 'Content-Length' => 0]);
         $this->client->send($request);
     } catch (ClientException $exception) {
         if ($exception->getCode() == 401) {
             $this->reconnect();
             return $this->copy($bucket, $destination, $name);
         }
         throw new ServerException($exception->getMessage(), $exception->getCode(), $exception);
     }
     return true;
 }