You are here

private function video_amazon_s3::replaceLocalFile in Video 6.4

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

Replace a file with a text file to reduce disk space usage.

Parameters

string $filepath:

string $s3url:

1 call to video_amazon_s3::replaceLocalFile()
video_amazon_s3::pushFile in plugins/video_s3/video_s3.lib.inc

File

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

Class

video_amazon_s3

Code

private function replaceLocalFile($filepath, $s3url) {
  if (file_delete($filepath) !== FALSE) {
    $fp = fopen($filepath, 'w+');
    if (!$fp) {
      return FALSE;
    }
    fwrite($fp, 'Moved to ' . $s3url);
    fclose($fp);
    chmod($filepath, 0644);
  }
}