Moodle  2.2.1
http://www.collinsharper.com
S3 Class Reference

Public Member Functions

 __construct ($accessKey=null, $secretKey=null, $useSSL=true)

Static Public Member Functions

static setAuth ($accessKey, $secretKey)
static listBuckets ($detailed=false)
static getBucket ($bucket, $prefix=null, $marker=null, $maxKeys=null, $delimiter=null)
static putBucket ($bucket, $acl=self::ACL_PRIVATE, $location=false)
static deleteBucket ($bucket)
static inputFile ($file, $md5sum=true)
static inputResource (&$resource, $bufferSize, $md5sum= '')
static putObject ($input, $bucket, $uri, $acl=self::ACL_PRIVATE, $metaHeaders=array(), $requestHeaders=array())
static putObjectFile ($file, $bucket, $uri, $acl=self::ACL_PRIVATE, $metaHeaders=array(), $contentType=null)
static putObjectString ($string, $bucket, $uri, $acl=self::ACL_PRIVATE, $metaHeaders=array(), $contentType= 'text/plain')
static getObject ($bucket, $uri, $saveTo=false)
static getObjectInfo ($bucket, $uri, $returnInfo=true)
static copyObject ($srcBucket, $srcUri, $bucket, $uri, $acl=self::ACL_PRIVATE)
static setBucketLogging ($bucket, $targetBucket, $targetPrefix=null)
static getBucketLogging ($bucket)
static disableBucketLogging ($bucket)
static getBucketLocation ($bucket)
static setAccessControlPolicy ($bucket, $uri= '', $acp=array())
static getAccessControlPolicy ($bucket, $uri= '')
static deleteObject ($bucket, $uri)
static getAuthenticatedURL ($bucket, $uri, $lifetime, $hostBucket=false, $https=false)
static createDistribution ($bucket, $enabled=true, $cnames=array(), $comment= '')
static getDistribution ($distributionId)
static updateDistribution ($dist)
static deleteDistribution ($dist)
static listDistributions ()
static __getMimeType (&$file)
static __getSignature ($string)

Data Fields

const ACL_PRIVATE = 'private'
const ACL_PUBLIC_READ = 'public-read'
const ACL_PUBLIC_READ_WRITE = 'public-read-write'

Static Public Attributes

static $useSSL = true

Detailed Description

Copyright (c) 2008, Donovan Schönknecht. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Amazon S3 is a trademark of Amazon.com, Inc. or its affiliates. Amazon S3 PHP class

0.3.8

Definition at line 36 of file S3.php.


Constructor & Destructor Documentation

__construct ( accessKey = null,
secretKey = null,
useSSL = true 
)

Constructor - if you're not using the class statically

Parameters:
string$accessKeyAccess key
string$secretKeySecret key
boolean$useSSLEnable SSL
Returns:
void

Definition at line 56 of file S3.php.

Here is the call graph for this function:


Member Function Documentation

static __getMimeType ( &$  file) [static]

Get MIME type for file

Definition at line 968 of file S3.php.

Here is the caller graph for this function:

static __getSignature ( string) [static]

Generate the auth string: "AWS AccessKey:Signature"

Definition at line 1016 of file S3.php.

Here is the caller graph for this function:

static copyObject ( srcBucket,
srcUri,
bucket,
uri,
acl = self::ACL_PRIVATE 
) [static]

Copy an object

Parameters:
string$bucketSource bucket name
string$uriSource object URI
string$bucketDestination bucket name
string$uriDestination object URI
constant$aclACL constant
Returns:
mixed | false

Definition at line 444 of file S3.php.

static createDistribution ( bucket,
enabled = true,
cnames = array(),
comment = '' 
) [static]

Create a CloudFront distribution

Parameters:
string$bucketBucket name
boolean$enabledEnabled (true/false)
array$cnamesArray containing CNAME aliases
string$commentUse the bucket name as the hostname
Returns:
array | false

Definition at line 745 of file S3.php.

static deleteBucket ( bucket) [static]

Delete an empty bucket

Parameters:
string$bucketBucket name
Returns:
boolean

Definition at line 222 of file S3.php.

static deleteDistribution ( dist) [static]

Delete a CloudFront distribution

Parameters:
array$distDistribution array info identical to output of getDistribution()
Returns:
boolean

Definition at line 826 of file S3.php.

static deleteObject ( bucket,
uri 
) [static]

Delete an object

Parameters:
string$bucketBucket name
string$uriObject URI
Returns:
boolean

Definition at line 703 of file S3.php.

static disableBucketLogging ( bucket) [static]

Disable bucket logging

Parameters:
string$bucketBucket name
Returns:
boolean

Definition at line 555 of file S3.php.

Here is the call graph for this function:

static getAccessControlPolicy ( bucket,
uri = '' 
) [static]

Get object or bucket Access Control Policy

Parameters:
string$bucketBucket name
string$uriObject URI
Returns:
mixed | false

Definition at line 647 of file S3.php.

static getAuthenticatedURL ( bucket,
uri,
lifetime,
hostBucket = false,
https = false 
) [static]

Get a query string authenticated URL

Parameters:
string$bucketBucket name
string$uriObject URI
integer$lifetimeLifetime in seconds
boolean$hostBucketUse the bucket name as the hostname
boolean$httpsUse HTTPS ($hostBucket should be false for SSL verification)
Returns:
string

Definition at line 727 of file S3.php.

static getBucket ( bucket,
prefix = null,
marker = null,
maxKeys = null,
delimiter = null 
) [static]

Definition at line 123 of file S3.php.

static getBucketLocation ( bucket) [static]

Get a bucket's location

Parameters:
string$bucketBucket name
Returns:
string | false

Definition at line 566 of file S3.php.

static getBucketLogging ( bucket) [static]

Get logging status for a bucket

This will return false if logging is not enabled. Note: To enable logging, you also need to grant write access to the log group

Parameters:
string$bucketBucket name
Returns:
array | false

Definition at line 530 of file S3.php.

static getDistribution ( distributionId) [static]

Get CloudFront distribution info

Parameters:
string$distributionIdDistribution ID from listDistributions()
Returns:
array | false

Definition at line 771 of file S3.php.

static getObject ( bucket,
uri,
saveTo = false 
) [static]

Get an object

Parameters:
string$bucketBucket name
string$uriObject URI
mixed$saveToFilename or resource to write to
Returns:
mixed

Definition at line 388 of file S3.php.

static getObjectInfo ( bucket,
uri,
returnInfo = true 
) [static]

Get object information

Parameters:
string$bucketBucket name
string$uriObject URI
boolean$returnInfoReturn response information
Returns:
mixed | false

Definition at line 420 of file S3.php.

static inputFile ( file,
md5sum = true 
) [static]

Create input info array for putObject()

Parameters:
string$fileInput file
mixed$md5sumUse MD5 hash (supply a string if you want to use your own)
Returns:
array | false

Definition at line 243 of file S3.php.

static inputResource ( &$  resource,
bufferSize,
md5sum = '' 
) [static]

Create input array info for putObject() with a resource

Parameters:
string$resourceInput resource to read from
integer$bufferSizeInput byte size
string$md5sumMD5 hash to send (optional)
Returns:
array | false

Definition at line 262 of file S3.php.

static listBuckets ( detailed = false) [static]

Get a list of buckets

Parameters:
boolean$detailedReturns detailed bucket list when true
Returns:
array | false

Definition at line 82 of file S3.php.

static listDistributions ( ) [static]

Get a list of CloudFront distributions

Returns:
array

Definition at line 848 of file S3.php.

static putBucket ( bucket,
acl = self::ACL_PRIVATE,
location = false 
) [static]

Put a bucket

Parameters:
string$bucketBucket name
constant$aclACL flag
string$locationSet as "EU" to create buckets hosted in Europe
Returns:
boolean

Definition at line 189 of file S3.php.

static putObject ( input,
bucket,
uri,
acl = self::ACL_PRIVATE,
metaHeaders = array(),
requestHeaders = array() 
) [static]

Put an object

Parameters:
mixed$inputInput data
string$bucketBucket name
string$uriObject URI
constant$aclACL constant
array$metaHeadersArray of x-amz-meta-* headers
array$requestHeadersArray of request headers or content type as a string
Returns:
boolean

Definition at line 284 of file S3.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static putObjectFile ( file,
bucket,
uri,
acl = self::ACL_PRIVATE,
metaHeaders = array(),
contentType = null 
) [static]

Put an object from a file (legacy function)

Parameters:
string$fileInput file path
string$bucketBucket name
string$uriObject URI
constant$aclACL constant
array$metaHeadersArray of x-amz-meta-* headers
string$contentTypeContent type
Returns:
boolean

Definition at line 359 of file S3.php.

Here is the call graph for this function:

static putObjectString ( string,
bucket,
uri,
acl = self::ACL_PRIVATE,
metaHeaders = array(),
contentType = 'text/plain' 
) [static]

Put an object from a string (legacy function)

Parameters:
string$stringInput data
string$bucketBucket name
string$uriObject URI
constant$aclACL constant
array$metaHeadersArray of x-amz-meta-* headers
string$contentTypeContent type
Returns:
boolean

Definition at line 375 of file S3.php.

Here is the call graph for this function:

static setAccessControlPolicy ( bucket,
uri = '',
acp = array() 
) [static]

Set object or bucket Access Control Policy

Parameters:
string$bucketBucket name
string$uriObject URI
array$acpAccess Control Policy Data (same as the data returned from getAccessControlPolicy)
Returns:
boolean

Definition at line 589 of file S3.php.

Here is the caller graph for this function:

static setAuth ( accessKey,
secretKey 
) [static]

Set AWS access key and secret key

Parameters:
string$accessKeyAccess key
string$secretKeySecret key
Returns:
void

Definition at line 70 of file S3.php.

Here is the caller graph for this function:

static setBucketLogging ( bucket,
targetBucket,
targetPrefix = null 
) [static]

Set logging for a bucket

Parameters:
string$bucketBucket name
string$targetBucketTarget bucket (where logs are stored)
string$targetPrefixLog prefix (e,g; domain.com-)
Returns:
boolean

Definition at line 471 of file S3.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static updateDistribution ( dist) [static]

Update a CloudFront distribution

Parameters:
array$distDistribution array info identical to output of getDistribution()
Returns:
array | false

Definition at line 797 of file S3.php.


Field Documentation

$useSSL = true [static]

Definition at line 42 of file S3.php.

const ACL_PRIVATE = 'private'

Definition at line 38 of file S3.php.

const ACL_PUBLIC_READ = 'public-read'

Definition at line 39 of file S3.php.

const ACL_PUBLIC_READ_WRITE = 'public-read-write'

Definition at line 40 of file S3.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations