mkdir ( $path, $mode, $options )

Create a new bucket. This method is called in response to mkdir().

Access

public

Parameters

Parameter

Type

Required

Description

$path

string

Required

The bucket name to create.

$mode

integer

Required

Permissions. 700-range permissions map to ACL_PUBLIC. 600-range permissions map to ACL_AUTH_READ. All other permissions map to ACL_PRIVATE. Expects octal form.

$options

integer

Required

Ignored.

Returns

Type

Description

boolean

Whether the bucket was created successfully or not.

Source

Method defined in extensions/s3streamwrapper.class.php | Toggle source view (28 lines) | View on GitHub

public function mkdir($path, $mode, $options)
{
    // Get the value that was *actually* passed in as mode, and default to 0
    $trace_slice = array_slice(debug_backtrace(), -1);
    $mode = isset($trace_slice[0]['args'][1]) ? decoct($trace_slice[0]['args'][1]) : 0;

    $this->path = $path;
    list($protocol, $bucket, $object_name) = $this->parse_path($path);

    if (in_array($mode, range(700, 799)))
    {
        $acl = AmazonS3::ACL_PUBLIC;
    }
    elseif (in_array($mode, range(600, 699)))
    {
        $acl = AmazonS3::ACL_AUTH_READ;
    }
    else
    {
        $acl = AmazonS3::ACL_PRIVATE;
    }

    $client = $this->client($protocol);
    $region = $client->hostname;
    $response = $client->create_bucket($bucket, $region, $acl);

    return $response->isOK();
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback