本文整理汇总了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;
}
}
示例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");
}
示例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");
}
示例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;
}
示例5: canStore
public function canStore()
{
$bucket = $this->_getBucketName();
return $this->_s3->isBucketAvailable($bucket);
}