Esempio n. 1
0
 private static function getFileSyncForKey(FileSyncKey $srcSyncKey, flavorParamsOutput $flavor, asset $flavorAsset, Partner $partner, &$addImportJob)
 {
     $addImportJob = false;
     $isLocal = $flavor->getSourceRemoteStorageProfileId() == StorageProfile::STORAGE_KALTURA_DC;
     if ($isLocal) {
         list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, true, false);
     } else {
         $fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($srcSyncKey, $flavor->getSourceRemoteStorageProfileId());
     }
     if (!$fileSync) {
         kBatchManager::updateEntry($flavorAsset->getEntryId(), entryStatus::ERROR_CONVERTING);
         if ($isLocal) {
             $description = "Source file sync not found: {$srcSyncKey}";
         } else {
             $description = "Remote source file sync not found {$srcSyncKey}, storage profile id [" . $flavor->getSourceRemoteStorageProfileId() . "]";
         }
         $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
         $flavorAsset->setDescription($description);
         $flavorAsset->save();
         KalturaLog::err($description);
         return null;
     }
     if ($isLocal && !$local) {
         if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL && $partner && $partner->getImportRemoteSourceForConvert()) {
             $addImportJob = true;
         } else {
             throw new kCoreException("Source file not found for flavor conversion [{$flavorAsset->getId}()]", kCoreException::SOURCE_FILE_NOT_FOUND);
         }
     }
     return $fileSync;
 }