protected function updatedVirusScanFinished(BatchJob $dbBatchJob, kVirusScanJobData $data, BatchJob $twinJob = null) { $flavorAsset = flavorAssetPeer::retrieveById($data->getFlavorAssetId()); if (!$flavorAsset) { KalturaLog::err('Flavor asset not found with id [' . $data->getFlavorAssetId() . ']'); throw new Exception('Flavor asset not found with id [' . $data->getFlavorAssetId() . ']'); } switch ($data->getScanResult()) { case KalturaVirusScanJobResult::FILE_WAS_CLEANED: case KalturaVirusScanJobResult::FILE_IS_CLEAN: $this->resumeEvents($flavorAsset); break; case KalturaVirusScanJobResult::FILE_INFECTED: $entry = $flavorAsset->getentry(); if (!$entry) { KalturaLog::err('Entry not found with id [' . $entry->getId() . ']'); } else { $entry->setStatus(VirusScanPlugin::getEntryStatusCoreValue(VirusScanEntryStatus::INFECTED)); $entry->save(); } // delete flavor asset and entry if defined in virus scan profile if ($data->getVirusFoundAction() == KalturaVirusFoundAction::CLEAN_DELETE || $data->getVirusFoundAction() == KalturaVirusFoundAction::DELETE) { $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); $filePath = kFileSyncUtils::getLocalFilePathForKey($syncKey); KalturaLog::debug('FlavorAsset [' . $flavorAsset->getId() . '] marked as deleted'); $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED); $flavorAsset->setDeletedAt(time()); $flavorAsset->save(); KalturaLog::debug('Physically deleting file [' . $filePath . ']'); unlink($filePath); if ($entry) { myEntryUtils::deleteEntry($entry); } } else { $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR); $flavorAsset->save(); } myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry); // do not resume flavor asset added event consumption break; } return $dbBatchJob; }