/** * @param BatchJob $parentJob * @param int $partnerId * @param string $entryId * @param string $flavorAssetId * @param string $srcFilePath * @param VirusScanEngineType $virusScanEngine * @param int $scanProfileId * @return BatchJob */ public static function addVirusScanJob(BatchJob $parentJob = null, $partnerId, $entryId, $flavorAssetId, $srcFilePath, $virusScanEngine, $virusFoundAction) { $jobData = new kVirusScanJobData(); $jobData->setSrcFilePath($srcFilePath); $jobData->setFlavorAssetId($flavorAssetId); $jobData->setVirusFoundAction($virusFoundAction); $batchJob = null; if ($parentJob) { $batchJob = $parentJob->createChild(); } else { $batchJob = new BatchJob(); $batchJob->setEntryId($entryId); $batchJob->setPartnerId($partnerId); } $jobType = VirusScanPlugin::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN); return self::addJob($batchJob, $jobData, $jobType, $virusScanEngine); }
protected function updatedVirusScanFailed(BatchJob $dbBatchJob, kVirusScanJobData $data, BatchJob $twinJob = null) { $entry = entryPeer::retrieveByPK($dbBatchJob->getEntryId()); if ($entry) { $entry->setStatus(VirusScanPlugin::getEntryStatusCoreValue(VirusScanEntryStatus::INFECTED)); $entry->save(); } else { KalturaLog::err('Entry not found with id [' . $dbBatchJob->getEntryId() . ']'); throw new Exception('Entry not found with id [' . $dbBatchJob->getEntryId() . ']'); } $flavorAsset = flavorAssetPeer::retrieveById($data->getFlavorAssetId()); if ($flavorAsset) { $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR); $flavorAsset->save(); } else { KalturaLog::err('Flavor asset not found with id [' . $data->getFlavorAssetId() . ']'); throw new Exception('Flavor asset not found with id [' . $data->getFlavorAssetId() . ']'); } // do not resume flavor asset added event consumption return $dbBatchJob; }
protected function updatedVirusScanFailed(BatchJob $dbBatchJob, kVirusScanJobData $data) { $entry = entryPeer::retrieveByPKNoFilter($dbBatchJob->getEntryId()); if ($entry) { self::setEntryStatusBeforeScanFailure($entry, $entry->getStatus()); $entry->setStatus(VirusScanPlugin::getEntryStatusCoreValue(VirusScanEntryStatus::SCAN_FAILURE)); $entry->save(); myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry); } else { KalturaLog::err('Entry not found with id [' . $dbBatchJob->getEntryId() . ']'); throw new Exception('Entry not found with id [' . $dbBatchJob->getEntryId() . ']'); } $flavorAsset = assetPeer::retrieveById($data->getFlavorAssetId()); if ($flavorAsset) { self::setFlavorAssetStatusBeforeScanFailure($flavorAsset, $flavorAsset->getStatus()); $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR); $flavorAsset->save(); } else { KalturaLog::err('Flavor asset not found with id [' . $data->getFlavorAssetId() . ']'); throw new Exception('Flavor asset not found with id [' . $data->getFlavorAssetId() . ']'); } // do not resume flavor asset added event consumption return $dbBatchJob; }