예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function __construct(FilesInterface $files, array $options)
 {
     parent::__construct($files, $options);
     if (!extension_loaded('ftp')) {
         throw new ServerException("Unable to initialize ftp storage server, extension 'ftp' not found.");
     }
     $this->connect();
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function __construct(FilesInterface $files, array $options)
 {
     parent::__construct($files, $options);
     if (!extension_loaded('ssh2')) {
         throw new ServerException("Unable to initialize sftp storage server, extension 'ssh2' not found.");
     }
     //Let's automatically connect!
     $this->connect();
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function __construct(FilesInterface $files, array $options)
 {
     parent::__construct($files, $options);
     //This code is going to use additional abstraction layer to connect storage and guzzle
     $this->client = new Client($this->options);
 }
예제 #4
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;
 }
예제 #5
0
 /**
  * @param FilesInterface $files
  * @param ODM            $odm
  * @param array          $options
  */
 public function __construct(FilesInterface $files, ODM $odm, array $options)
 {
     parent::__construct($files, $options);
     $this->database = $odm->database($this->options['database']);
 }