コード例 #1
0
 /**
  * Run backup
  *
  * @param null|string $data
  * @return bool
  * @throws PermissionException
  * @throws RuntimeException
  */
 public function backup($data = null)
 {
     $filename = $this->getFilename();
     $configuration = $this->options->get('credentials');
     $client = new S3Client(['credentials' => ['key' => $configuration['key'], 'secret' => $configuration['secret']], 'region' => $configuration['region'], 'version' => 'latest']);
     $adapter = new AwsS3Adapter($client, $configuration['bucket']);
     $config = new \League\Flysystem\Config(['mimetype' => 'application/octet-stream']);
     if (!$adapter->write($this->getPath() . $filename, $data, $config)) {
         throw new RunTimeException('Please check your configuration for Amazon s3');
     }
     return true;
 }
コード例 #2
0
 public function getTest2(AwsS3Adapter $cloud)
 {
     $cloud->write('', 'test5.txt', 'to fix I am using aws s31');
     //$cloud->get(), append(), files()
     return 'done';
 }