You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not too familiar with github but thought I'd share a method I wrote to get the storage class of an item. I pulled most of the info from here: https://forums.aws.amazon.com/message.jspa?messageID=312224
There might be better ways to do it but the code works so thought I'd share:
I'm not too familiar with github but thought I'd share a method I wrote to get the storage class of an item. I pulled most of the info from here: https://forums.aws.amazon.com/message.jspa?messageID=312224
There might be better ways to do it but the code works so thought I'd share:
/**
* Get object StorageClass
*
* @param string $bucket Bucket name
* @param string $uri Object URI
* @return string | false
*/
public static function getObjectStorageClass($bucket, $uri)
{
$rest = new S3Request('GET', $bucket, '', self::$endpoint);
$rest->setParameter('prefix', $uri);
$rest = $rest->getResponse();
if ($rest->error === false && ($rest->code !== 200 && $rest->code !== 404))
$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
if ($rest->error !== false)
{
self::triggerError(sprintf("S3::getObjectStorageClass({$bucket}, {$uri}): [%s] %s",
$rest->error['code'], $rest->error['message']), __FILE, LINE);
return false;
}
return (string) $rest->body->Contents->StorageClass;
}
The text was updated successfully, but these errors were encountered: