当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Service_Amazon_S3::isBucketAvailable方法代码示例

本文整理汇总了PHP中Zend_Service_Amazon_S3::isBucketAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Service_Amazon_S3::isBucketAvailable方法的具体用法?PHP Zend_Service_Amazon_S3::isBucketAvailable怎么用?PHP Zend_Service_Amazon_S3::isBucketAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Service_Amazon_S3的用法示例。


在下文中一共展示了Zend_Service_Amazon_S3::isBucketAvailable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _createBucketIfNecessary

 protected function _createBucketIfNecessary()
 {
     if (!$this->_bucketExists) {
         if (!$this->_api->isBucketAvailable($this->_config['bucket'])) {
             $this->_api->createBucket($this->_config['bucket']);
         }
         $this->_bucketExists = true;
     }
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:9,代码来源:S3.php

示例2: testBucketIPMaskPostCondition

 /**
  * Test creating bucket with IP
  *
  * ZF-6686
  */
 public function testBucketIPMaskPostCondition()
 {
     try {
         $this->_amazon->createBucket("127.0.0.1");
     } catch (\Zend\Service\Amazon\Sqs\Exception\InvalidArgumentException $e) {
         $this->_amazon->createBucket("123-456-789-123");
         $this->assertTrue($this->_amazon->isBucketAvailable("123-456-789-123"));
         $this->_amazon->removeBucket("123-456-789-123");
         return;
     }
     $this->fail("Failed to throw expected exception");
 }
开发者ID:navassouza,项目名称:zf2,代码行数:17,代码来源:OnlineTest.php

示例3: testBucketIPMask

 /**
  * Test creating bucket with IP
  *
  * ZF-6686
  */
 public function testBucketIPMask()
 {
     try {
         $this->_amazon->createBucket("127.0.0.1");
         $this->fail("Failed to throw expected exception");
     } catch (Zend_Service_Amazon_S3_Exception $e) {
         $this->assertContains("cannot be an IP address", $e->getMessage());
     }
     $this->_amazon->createBucket("123-456-789-123");
     $this->assertTrue($this->_amazon->isBucketAvailable("123-456-789-123"));
     $this->_amazon->removeBucket("123-456-789-123");
 }
开发者ID:vicfryzel,项目名称:zf,代码行数:17,代码来源:OnlineTest.php

示例4: removeAmazonS3Object

 /**
  * Removes the object specified by the file name and user id
  * @param unknown_type $user_id
  * @param unknown_type $file_name
  * @return boolean
  */
 private function removeAmazonS3Object($user_id, $file_name)
 {
     // TODO: make this asynchronous later
     global $app;
     $objectURL = null;
     $aws_key = null;
     $aws_secret_key = null;
     $aws_key = $app->configData['configuration']['api_keys']['value']['amazon_aws_key']['value'];
     $aws_secret_key = $app->configData['configuration']['api_keys']['value']['amazon_aws_secret']['value'];
     $amazon_bucket_name = $app->configData['configuration']['api_keys']['value']['amazon_s3_bucket']['value'];
     if (isset($aws_key) && isset($aws_secret_key)) {
         $s3 = null;
         $bucketAvailable = false;
         $s3 = new Zend_Service_Amazon_S3($aws_key, $aws_secret_key);
         $bucketAvailable = $s3->isBucketAvailable($amazon_bucket_name);
         if ($bucketAvailable) {
             // bucket is available so try to delete the object
             try {
                 foreach ($this->_image_sizes as $imageSizeType => $imageDimensions) {
                     $objectPath = $this->buildAmazonS3ObjectURL($imageSizeType, $user_id, $file_name);
                     $objectPath = $amazon_bucket_name . $objectPath;
                     $s3->removeObject($objectPath);
                 }
                 return true;
             } catch (Exception $e) {
                 // ignore this error - the extra amazons3 object in the bucket
                 // will not harm anything. It will just be an unclean directory
                 // take care of cleaning asynchronously by deleting orphan objects
                 // that do not appear in the user's picture/avatar urls
                 //$this->message = $e->getMessage();
             }
         } else {
             // no bucket is available
             return false;
         }
     }
     return false;
 }
开发者ID:CivicCommons,项目名称:people-aggregator,代码行数:44,代码来源:EditProfileModule.php

示例5: canStore

 public function canStore()
 {
     $bucket = $this->_getBucketName();
     return $this->_s3->isBucketAvailable($bucket);
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:5,代码来源:ZendS3.php


注:本文中的Zend_Service_Amazon_S3::isBucketAvailable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。