You are here

private function TranscoderAbstractionFactoryZencoder::moveFile in Video 7.2

2 calls to TranscoderAbstractionFactoryZencoder::moveFile()
TranscoderAbstractionFactoryZencoder::extractFrames in transcoders/TranscoderAbstractionFactoryZencoder.inc
For new videos, this function is never called, because all thumbnails are extracted and saved to the databases during the post back handler in TranscoderAbstractionFactoryZencoder::processPostback().
TranscoderAbstractionFactoryZencoder::processPostback in transcoders/TranscoderAbstractionFactoryZencoder.inc
Process postback jobs

File

transcoders/TranscoderAbstractionFactoryZencoder.inc, line 824
File containing class TranscoderAbstractionFactoryZencoder

Class

TranscoderAbstractionFactoryZencoder
Class that handles Zencoder transcoding.

Code

private function moveFile($srcurl, $dsturi) {
  $unlinksrc = FALSE;

  // If the Amazon S3 or Cloud Files module is used, we know that the file is on s3:// or rcf://.
  // We must move the file, because the original must be deleted.
  if ($this->outputdestination == 's3' || $this->outputdestination == 'rcf') {
    $srcuri = $this->outputdestination . ':/' . parse_url($srcurl, PHP_URL_PATH);

    // Check if the file is already at the right place
    if ($srcuri === $dsturi) {
      return TRUE;
    }

    // Move the file if the target is also s3:// or rcf://
    if (file_uri_scheme($dsturi) == $this->outputdestination) {
      $result = rename($srcuri, $dsturi);
      clearstatcache();
      return $result;
    }

    // The src file needs to be removed after copying.
    $unlinksrc = TRUE;
  }

  // Check if $srcurl is actually a $uri
  $srcuri = $srcurl;
  if (strncmp('http', $srcuri, 4) === 0) {
    $srcuri = video_utility::urlToUri($srcurl);
    if ($srcuri === NULL) {
      $srcuri = $srcurl;
    }
  }

  // Check if the file is already at the right place
  if ($srcuri === $dsturi) {
    return TRUE;
  }
  $result = copy($srcuri, $dsturi);
  if ($result && $unlinksrc) {
    unlink($srcuri);
  }

  // Clear the stat cache after the copy.
  clearstatcache();
  return $result;
}