Exemplo n.º 1
0
 private static function handleFlavorAssetConvertFinished(flavorAsset $flavorAsset, flavorParamsOutput $flavorParamsOutput, BatchJob $dbBatchJob, kConvertJobData $data)
 {
     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $storageProfileId = $flavorParamsOutput->getSourceRemoteStorageProfileId();
     if ($storageProfileId == StorageProfile::STORAGE_KALTURA_DC) {
         kFileSyncUtils::moveFromFile($data->getDestFileSyncLocalPath(), $syncKey);
     } elseif ($flavorParamsOutput->getRemoteStorageProfileIds()) {
         $remoteStorageProfileIds = explode(',', $flavorParamsOutput->getRemoteStorageProfileIds());
         foreach ($remoteStorageProfileIds as $remoteStorageProfileId) {
             $storageProfile = StorageProfilePeer::retrieveByPK($remoteStorageProfileId);
             kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $data->getDestFileSyncLocalPath(), $storageProfile);
         }
     }
     // creats the file sync
     if (file_exists($data->getLogFileSyncLocalPath())) {
         $logSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
         try {
             kFileSyncUtils::moveFromFile($data->getLogFileSyncLocalPath(), $logSyncKey);
         } catch (Exception $e) {
             $err = 'Saving conversion log: ' . $e->getMessage();
             KalturaLog::err($err);
             $desc = $dbBatchJob->getDescription() . "\n" . $err;
             $dbBatchJob->getDescription($desc);
         }
     }
     if ($storageProfileId == StorageProfile::STORAGE_KALTURA_DC) {
         $data->setDestFileSyncLocalPath(kFileSyncUtils::getLocalFilePathForKey($syncKey));
         // save the data changes to the db
         $dbBatchJob->setData($data);
         $dbBatchJob->save();
     }
 }