/** * @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); }
/** * @param BatchJob $dbBatchJob * @param BatchJob $twinJob * @return bool true if should continue to the next consumer */ public function updatedJob(BatchJob $dbBatchJob, BatchJob $twinJob = null) { // virus scan only works in api_v3 context because it uses dynamic enums if (!class_exists('kCurrentContext') || !kCurrentContext::isApiV3Context()) { return true; } if ($dbBatchJob->getJobType() == VirusScanPlugin::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN)) { $dbBatchJob = $this->updatedVirusScan($dbBatchJob, $dbBatchJob->getData(), $twinJob); } return true; }
public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { if (!class_exists('kCurrentContext') || !kCurrentContext::isApiV3Context()) { return false; } if ($dbBatchJob->getJobType() == VirusScanPlugin::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN)) { return true; } return false; }
/** * batch freeExclusiveVirusScanJob action frees a BatchJob of type VirusScan that was claimed using the getExclusiveVirusScanJobs * * @action freeExclusiveVirusScanJob * @param int $id The id of the job to free * @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism * @param bool $resetExecutionAttempts Resets the job execution attampts to zero * @return KalturaFreeJobResponse */ function freeExclusiveVirusScanJobAction($id, KalturaExclusiveLockKey $lockKey, $resetExecutionAttempts = false) { $jobType = VirusScanPlugin::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN); return $this->freeExclusiveJobAction($id, $lockKey, $jobType, $resetExecutionAttempts); }