delete_bucket ( $bucket, $force, $opt )

Deletes a bucket from an Amazon S3 account. A bucket must be empty before the bucket itself can be deleted.

Access

public

Parameters

Parameter

Type

Required

Description

$bucket

string

Required

The name of the bucket to use.

$force

boolean

Optional

Whether to force-delete the bucket and all of its contents. The default value is false.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

mixed

A CFResponse object if the bucket was deleted successfully. Returns boolean false if otherwise.

Examples


							

Source

Method defined in services/s3.class.php | Toggle source view (24 lines) | View on GitHub

public function delete_bucket($bucket, $force = false, $opt = null)
{
    // Set default value
    $success = true;

    if ($force)
    {
        // Delete all of the items from the bucket.
        $success = $this->delete_all_object_versions($bucket);
    }

    // As long as we were successful...
    if ($success)
    {
        if (!$opt) $opt = array();
        $opt['verb'] = 'DELETE';

        return $this->authenticate($bucket, $opt);
    }

    // @codeCoverageIgnoreStart
    return false;
    // @codeCoverageIgnoreEnd
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback