function storage_s3_file_exists($object_id, $more = array())
{
    $rsp = s3_head(storage_s3_bucket(), $object_id);
    if ($rsp['ok']) {
        log_debug('s3', "exists: {$object_id}");
        return 1;
    } else {
        return 0;
    }
}
Example #2
0
function s3_verify_etag($bucket, $object_id, $etag)
{
    $more = array('expires' => time() + 300, 'method' => 'HEAD');
    $rsp = s3_head($bucket, $object_id, $more);
    if (!$rsp['ok']) {
        return $rsp;
    }
    $ok = $rsp['headers']['etag'] == $etag ? 1 : 0;
    return array('ok' => $ok);
}