You are here

public function video_amazon_s3::replaceLocalFile in Video 6.5

Same name and namespace in other branches
  1. 6.4 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:

File

plugins/video_s3/video_s3.lib.inc, line 300
Class file to handle amazon s3 transfers.

Class

video_amazon_s3

Code

public 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);
  }
}