Пример #1
0
 public function tearDown()
 {
     if ($this->instance) {
         $s3 = new AmazonS3(array('key' => $this->config['amazons3']['key'], 'secret' => $this->config['amazons3']['secret']));
         if ($s3->delete_all_objects($this->id)) {
             $s3->delete_bucket($this->id);
         }
     }
 }
 public static function deleteBucket($app)
 {
     $user_storage_s3 = Doctrine::getTable('GcrUserStorageS3')->findOneByAppId($app->getShortName());
     if ($user_storage_s3) {
         $account = GcrUserStorageS3Table::getAccount($app);
         define('AWS_KEY', $account->getAccessKeyId());
         define('AWS_SECRET_KEY', $account->getSecretAccessKey());
         gcr::loadSdk('aws');
         $api = new AmazonS3();
         $api->delete_bucket($user_storage_s3->getBucketName(), true);
         $user_storage_s3->delete();
     }
 }
 protected function execute($arguments = array(), $options = array())
 {
     $this->configuration = ProjectConfiguration::getApplicationConfiguration($options['app'], $options['env'], true);
     if (!sfConfig::get('app_sf_amazon_plugin_access_key', false)) {
         throw new sfException(sprintf('You have not set an amazon access key'));
     }
     if (!sfConfig::get('app_sf_amazon_plugin_secret_key', false)) {
         throw new sfException(sprintf('You have not set an amazon secret key'));
     }
     $s3 = new AmazonS3(sfConfig::get('app_sf_amazon_plugin_access_key'), sfConfig::get('app_sf_amazon_plugin_secret_key'));
     $response = $s3->delete_bucket($arguments['bucket'], $options['force']);
     if ($response->isOk()) {
         $this->logSection('Bucket-', sprintf('"%s" bucket has been deleted', $arguments['bucket']));
     } else {
         throw new sfException($this->body->Message);
     }
 }
 public function deleteAmazonBucket($name)
 {
     ProjectConfiguration::registerAws();
     $s3 = new AmazonS3();
     if ($s3->if_bucket_exists($name)) {
         return $s3->delete_bucket($name, true);
     }
 }