You are here

private function video_amazon_s3::update_headers in Video 6.4

Same name and namespace in other branches
  1. 6.5 plugins/video_s3/video_s3.lib.inc \video_amazon_s3::update_headers()
1 call to video_amazon_s3::update_headers()
video_amazon_s3::queue in plugins/video_s3/video_s3.lib.inc

File

plugins/video_s3/video_s3.lib.inc, line 318

Class

video_amazon_s3

Code

private function update_headers($file, $permission, $headers) {
  $filepath = $file->filepath;

  // For old video's (pre-4.5), the filename property is actually the path we need
  if (strpos('/', $file->filename) !== FALSE) {
    $filepath = $file->filename;
  }

  // Reset the Content-Type header usually sent when the S3 library puts a
  // file - we'll lose it otherwise.
  $headers['Content-Type'] = $file->filemime;
  $item = array(
    'bucket' => $file->bucket,
    'filename' => $filepath,
  );
  return $this->s3
    ->copy_object($item, $item, array(
    'acl' => $permission,
    'headers' => $headers,
  ))
    ->isOK();
}