Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Public Member Functions | |
__construct ($accessKey=null, $secretKey=null, $useSSL=false, $endpoint='s3.amazonaws.com') | |
Constructor - if you're not using the class statically. | |
setEndpoint ($host) | |
Set the service endpoint. | |
Static Public Member Functions | |
static | __getSignature ($string) |
Generate the auth string: "AWS AccessKey:Signature". | |
static | __getTime () |
Get the current time. | |
static | copyObject ($srcBucket, $srcUri, $bucket, $uri, $acl=self::ACL_PRIVATE, $metaHeaders=array(), $requestHeaders=array(), $storageClass=self::STORAGE_CLASS_STANDARD) |
Copy an object. | |
static | createDistribution ($bucket, $enabled=true, $cnames=array(), $comment=null, $defaultRootObject=null, $originAccessIdentity=null, $trustedSigners=array()) |
Create a CloudFront distribution. | |
static | deleteBucket ($bucket) |
Delete an empty bucket. | |
static | deleteDistribution ($dist) |
Delete a CloudFront distribution. | |
static | deleteObject ($bucket, $uri) |
Delete an object. | |
static | disableBucketLogging ($bucket) |
Disable bucket logging. | |
static | freeSigningKey () |
Free signing key from memory, MUST be called if you are using setSigningKey() | |
static | getAccessControlPolicy ($bucket, $uri='') |
Get object or bucket Access Control Policy. | |
static | getAuthenticatedURL ($bucket, $uri, $lifetime, $hostBucket=false, $https=false) |
Get a query string authenticated URL. | |
static | getBucket ($bucket, $prefix=null, $marker=null, $maxKeys=null, $delimiter=null, $returnCommonPrefixes=false) |
Get contents for a bucket. | |
static | getBucketLocation ($bucket) |
Get a bucket's location. | |
static | getBucketLogging ($bucket) |
Get logging status for a bucket. | |
static | getDistribution ($distributionId) |
Get CloudFront distribution info. | |
static | getDistributionInvalidationList ($distributionId) |
List your invalidation batches for invalidateDistribution() in a CloudFront distribution. | |
static | getHttpUploadPostParams ($bucket, $uriPrefix='', $acl=self::ACL_PRIVATE, $lifetime=3600, $maxFileSize=5242880, $successRedirect="201", $amzHeaders=array(), $headers=array(), $flashVars=false) |
Get upload POST parameters for form uploads. | |
static | getObject ($bucket, $uri, $saveTo=false) |
Get an object. | |
static | getObjectInfo ($bucket, $uri, $returnInfo=true) |
Get object information. | |
static | getSignedCannedURL ($url, $lifetime) |
Get a CloudFront canned policy URL. | |
static | getSignedPolicyURL ($policy) |
Get a CloudFront signed policy URL. | |
static | hasAuth () |
Check if AWS keys have been set. | |
static | inputFile ($file, $md5sum=true) |
Create input info array for putObject() | |
static | inputResource (&$resource, $bufferSize=false, $md5sum='') |
Create input array info for putObject() with a resource. | |
static | invalidateDistribution ($distributionId, $paths) |
Invalidate objects in a CloudFront distribution. | |
static | listBuckets ($detailed=false) |
Get a list of buckets. | |
static | listDistributions () |
Get a list of CloudFront distributions. | |
static | listOriginAccessIdentities () |
List CloudFront Origin Access Identities. | |
static | putBucket ($bucket, $acl=self::ACL_PRIVATE, $location=false) |
Put a bucket. | |
static | putObject ($input, $bucket, $uri, $acl=self::ACL_PRIVATE, $metaHeaders=array(), $requestHeaders=array(), $storageClass=self::STORAGE_CLASS_STANDARD, $serverSideEncryption=self::SSE_NONE) |
Put an object. | |
static | putObjectFile ($file, $bucket, $uri, $acl=self::ACL_PRIVATE, $metaHeaders=array(), $contentType=null) |
Put an object from a file (legacy function) | |
static | putObjectString ($string, $bucket, $uri, $acl=self::ACL_PRIVATE, $metaHeaders=array(), $contentType='text/plain') |
Put an object from a string (legacy function) | |
static | setAccessControlPolicy ($bucket, $uri='', $acp=array()) |
Set object or bucket Access Control Policy. | |
static | setAuth ($accessKey, $secretKey) |
Set AWS access key and secret key. | |
static | setBucketLogging ($bucket, $targetBucket, $targetPrefix=null) |
Set logging for a bucket. | |
static | setBucketRedirect ($bucket=NULL, $location=NULL) |
Set up a bucket redirection. | |
static | setExceptions ($enabled=true) |
Set the error mode to exceptions. | |
static | setProxy ($host, $user=null, $pass=null, $type=CURLPROXY_SOCKS5) |
Set proxy information. | |
static | setSigningKey ($keyPairId, $signingKey, $isFile=true) |
Set signing key. | |
static | setSSL ($enabled, $validate=true) |
Set SSL on or off. | |
static | setSSLAuth ($sslCert=null, $sslKey=null, $sslCACert=null) |
Set SSL client certificates (experimental) | |
static | setTimeCorrectionOffset ($offset=0) |
Set AWS time correction offset (use carefully) | |
static | updateDistribution ($dist) |
Update a CloudFront distribution. | |
Static Public Attributes | |
static string | $defDelimiter = null |
Default delimiter to be used, for example while getBucket(). | |
static string | $endpoint = 's3.amazonaws.com' |
AWS URI. | |
static null array | $proxy = null |
Proxy information. | |
static string | $sslCACert = null |
SSL CA cert (only required if you are having problems with your system CA cert) | |
static string | $sslCert = null |
SSL client certfificate. | |
static bool | $sslKey = null |
SSL client key. | |
static bool | $useExceptions = false |
Use PHP exceptions? | |
static bool | $useSSL = false |
Connect using SSL? | |
static bool | $useSSLValidation = true |
Use SSL validation? | |
static const | $useSSLVersion = CURL_SSLVERSION_TLSv1 |
Use SSL version. | |
Amazon S3 PHP class.
@externalurl http://undesigned.org.za/2007/10/22/amazon-s3-php-class
S3::__construct | ( | $accessKey = null, | |
$secretKey = null, | |||
$useSSL = false, | |||
$endpoint = 's3.amazonaws.com' ) |
Constructor - if you're not using the class statically.
string | $accessKey | Access key |
string | $secretKey | Secret key |
boolean | $useSSL | Enable SSL |
string | $endpoint | Amazon URI |
void |
|
static |
Copy an object.
string | $srcBucket | Source bucket name |
string | $srcUri | Source object URI |
string | $bucket | Destination bucket name |
string | $uri | Destination object URI |
constant | $acl | ACL constant |
array | $metaHeaders | Optional array of x-amz-meta-* headers |
array | $requestHeaders | Optional array of request headers (content type, disposition, etc.) |
constant | $storageClass | Storage class constant |
mixed | | false |
|
static |
Create a CloudFront distribution.
string | $bucket | Bucket name |
boolean | $enabled | Enabled (true/false) |
array | $cnames | Array containing CNAME aliases |
string | $comment | Use the bucket name as the hostname |
string | $defaultRootObject | Default root object |
string | $originAccessIdentity | Origin access identity |
array | $trustedSigners | Array of trusted signers |
array | | false |
|
static |
Delete an empty bucket.
string | $bucket | Bucket name |
boolean |
|
static |
Delete a CloudFront distribution.
array | $dist | Distribution array info identical to output of getDistribution() |
boolean |
|
static |
Delete an object.
string | $bucket | Bucket name |
string | $uri | Object URI |
boolean |
|
static |
Disable bucket logging.
string | $bucket | Bucket name |
boolean |
|
static |
Free signing key from memory, MUST be called if you are using setSigningKey()
void |
|
static |
Get object or bucket Access Control Policy.
string | $bucket | Bucket name |
string | $uri | Object URI |
mixed | | false |
|
static |
Get a query string authenticated URL.
string | $bucket | Bucket name |
string | $uri | Object URI |
integer | $lifetime | Lifetime in seconds |
boolean | $hostBucket | Use the bucket name as the hostname |
boolean | $https | Use HTTPS ($hostBucket should be false for SSL verification) |
string |
|
static |
Get contents for a bucket.
If maxKeys is null this method will loop through truncated result sets
string | $bucket | Bucket name |
string | $prefix | Prefix |
string | $marker | Marker (last file listed) |
string | $maxKeys | Max keys (maximum number of keys to return) |
string | $delimiter | Delimiter |
boolean | $returnCommonPrefixes | Set to true to return CommonPrefixes |
array | | false |
|
static |
Get a bucket's location.
string | $bucket | Bucket name |
string | | false |
|
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
string | $bucket | Bucket name |
array | | false |
|
static |
Get CloudFront distribution info.
string | $distributionId | Distribution ID from listDistributions() |
array | | false |
|
static |
List your invalidation batches for invalidateDistribution() in a CloudFront distribution.
http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/ListInvalidation.html returned array looks like this: Array ( [I31TWB0CN9V6XD] => InProgress [IT3TFE31M0IHZ] => Completed [I12HK7MPO1UQDA] => Completed [I1IA7R6JKTC3L2] => Completed )
string | $distributionId | Distribution ID from listDistributions() |
array |
|
static |
Get upload POST parameters for form uploads.
string | $bucket | Bucket name |
string | $uriPrefix | Object URI prefix |
constant | $acl | ACL constant |
integer | $lifetime | Lifetime in seconds |
integer | $maxFileSize | Maximum filesize in bytes (default 5MB) |
string | $successRedirect | Redirect URL or 200 / 201 status code |
array | $amzHeaders | Array of x-amz-meta-* headers |
array | $headers | Array of request headers or content type as a string |
boolean | $flashVars | Includes additional "Filename" variable posted by Flash |
object |
|
static |
Get an object.
string | $bucket | Bucket name |
string | $uri | Object URI |
mixed | $saveTo | Filename or resource to write to |
mixed |
|
static |
Get object information.
string | $bucket | Bucket name |
string | $uri | Object URI |
boolean | $returnInfo | Return response information |
mixed | | false |
|
static |
Get a CloudFront canned policy URL.
string | $url | URL to sign |
integer | $lifetime | URL lifetime |
string |
|
static |
Get a CloudFront signed policy URL.
array | $policy | Policy |
string |
|
static |
Check if AWS keys have been set.
boolean |
|
static |
Create input info array for putObject()
string | $file | Input file |
mixed | $md5sum | Use MD5 hash (supply a string if you want to use your own) |
array | | false |
|
static |
Create input array info for putObject() with a resource.
string | $resource | Input resource to read from |
integer | $bufferSize | Input byte size |
string | $md5sum | MD5 hash to send (optional) |
array | | false |
|
static |
Invalidate objects in a CloudFront distribution.
Thanks to Martin Lindkvist for S3\invalidateDistribution()
string | $distributionId | Distribution ID from listDistributions() |
array | $paths | Array of object paths to invalidate |
boolean |
|
static |
Get a list of buckets.
boolean | $detailed | Returns detailed bucket list when true |
array | | false |
|
static |
Get a list of CloudFront distributions.
array |
|
static |
List CloudFront Origin Access Identities.
array |
|
static |
Put a bucket.
string | $bucket | Bucket name |
constant | $acl | ACL flag |
string | $location | Set as "EU" to create buckets hosted in Europe |
boolean |
|
static |
Put an object.
mixed | $input | Input data |
string | $bucket | Bucket name |
string | $uri | Object URI |
constant | $acl | ACL constant |
array | $metaHeaders | Array of x-amz-meta-* headers |
array | $requestHeaders | Array of request headers or content type as a string |
constant | $storageClass | Storage class constant |
constant | $serverSideEncryption | Server-side encryption |
boolean |
|
static |
Put an object from a file (legacy function)
string | $file | Input file path |
string | $bucket | Bucket name |
string | $uri | Object URI |
constant | $acl | ACL constant |
array | $metaHeaders | Array of x-amz-meta-* headers |
string | $contentType | Content type |
boolean |
|
static |
Put an object from a string (legacy function)
string | $string | Input data |
string | $bucket | Bucket name |
string | $uri | Object URI |
constant | $acl | ACL constant |
array | $metaHeaders | Array of x-amz-meta-* headers |
string | $contentType | Content type |
boolean |
|
static |
Set object or bucket Access Control Policy.
string | $bucket | Bucket name |
string | $uri | Object URI |
array | $acp | Access Control Policy Data (same as the data returned from getAccessControlPolicy) |
boolean |
|
static |
Set AWS access key and secret key.
string | $accessKey | Access key |
string | $secretKey | Secret key |
void |
|
static |
Set logging for a bucket.
string | $bucket | Bucket name |
string | $targetBucket | Target bucket (where logs are stored) |
string | $targetPrefix | Log prefix (e,g; domain.com-) |
boolean |
|
static |
Set up a bucket redirection.
string | $bucket | Bucket name |
string | $location | Target host name |
boolean |
S3::setEndpoint | ( | $host | ) |
Set the service endpoint.
string | $host | Hostname |
void |
|
static |
Set the error mode to exceptions.
boolean | $enabled | Enable exceptions |
void |
|
static |
Set proxy information.
string | $host | Proxy hostname and port (localhost:1234) |
string | $user | Proxy username |
string | $pass | Proxy password |
constant | $type | CURL proxy type |
void |
|
static |
Set signing key.
string | $keyPairId | AWS Key Pair ID |
string | $signingKey | Private Key |
boolean | $isFile | Load private key from file, set to false to load string |
boolean |
|
static |
Set SSL on or off.
boolean | $enabled | SSL enabled |
boolean | $validate | SSL certificate validation |
void |
|
static |
Set SSL client certificates (experimental)
string | $sslCert | SSL client certificate |
string | $sslKey | SSL client key |
string | $sslCACert | SSL CA cert (only required if you are having problems with your system CA cert) |
void |
|
static |
Set AWS time correction offset (use carefully)
This can be used when an inaccurate system time is generating invalid request signatures. It should only be used as a last resort when the system time cannot be changed.
string | $offset | Time offset (set to zero to use AWS server time) |
void |
|
static |
Update a CloudFront distribution.
array | $dist | Distribution array info identical to output of getDistribution() |
array | | false |
|
static |
AWS URI.
@acess public
|
static |
SSL client certfificate.
@acess public