/** * @param kFileTransferMgr $fileManager * @param KalturaFtpDistributionFile $file * @param KalturaFtpDistributionProfile $distributionProfile * @return KalturaDistributionRemoteMediaFile */ protected function distributeFile(kFileTransferMgr $fileManager, KalturaFtpDistributionFile $file, KalturaFtpDistributionProfile $distributionProfile) { $remoteFilePath = $this->cleanPath($distributionProfile->basePath . '/' . $file->filename); KalturaLog::debug('Remote file path [' . $remoteFilePath . ']'); if ($file->contents) { $filename = uniqid(null, true) . '.' . pathinfo($file->filename, PATHINFO_EXTENSION); $localTempFilePath = $this->tempFilePath . '/' . $filename; KalturaLog::debug('Sending contents, using temp path [' . $localTempFilePath . ']'); file_put_contents($localTempFilePath, $file->contents); $fileManager->putFile($remoteFilePath, $localTempFilePath); unlink($localTempFilePath); } else { KalturaLog::debug('Sending local file [' . $file->localFilePath . ']'); $fileManager->putFile($remoteFilePath, $file->localFilePath); } $remoteFile = new KalturaDistributionRemoteMediaFile(); if ($file->hash) { $remoteFile->version = $file->version . '_' . $file->hash; } else { $remoteFile->version = $file->version; } $remoteFile->assetId = $file->assetId; $remoteFile->remoteId = $remoteFilePath; // remote id is the file path, later it will be used to delete the distributed files return $remoteFile; }
/** * Tests kFileTransferMgr->putFile() */ public function testPutFile() { // TODO Auto-generated kFileTransferMgrTest->testPutFile() $this->markTestIncomplete("putFile test not implemented"); $this->kFileTransferMgr->putFile(); }