/** * Update relevant filesync as FAILED. * No need to throw exception if the file sync not found, the job already marked as failed anyway. * * @param BatchJob $dbBatchJob * @param kFileSyncImportJobData $data * @param BatchJob $twinJob * @return BatchJob */ protected function updatedFileSyncImportFailed(BatchJob $dbBatchJob, kFileSyncImportJobData $data, BatchJob $twinJob = null) { $fileSyncId = $data->getFilesyncId(); if (!$fileSyncId) { KalturaLog::err('File sync ID not found in job data.'); return $dbBatchJob; } $fileSync = FileSyncPeer::retrieveByPK($fileSyncId); if (!$fileSync) { KalturaLog::err("Invalid filesync record with id [{$fileSyncId}]"); return $dbBatchJob; } $fileSync->setStatus(FileSync::FILE_SYNC_STATUS_ERROR); $fileSync->save(); return $dbBatchJob; }
protected function updatedFileSyncImportFailed(BatchJob $dbBatchJob, kFileSyncImportJobData $data, BatchJob $twinJob = null) { // Update relevant filesync as FAILED $fileSyncId = $data->getFilesyncId(); if (!$fileSyncId) { KalturaLog::err('File sync ID not found in job data.'); throw new KalturaAPIException(MultiCentersErrors::INVALID_FILESYNC_ID); } $fileSync = FileSyncPeer::retrieveByPK($fileSyncId); if (!$fileSync) { KalturaLog::err("Invalid filesync record with id [{$fileSyncId}]"); throw new KalturaAPIException(MultiCentersErrors::INVALID_FILESYNC_RECORD, $fileSyncId); } $fileSync->setStatus(FileSync::FILE_SYNC_STATUS_ERROR); $fileSync->setReadyAt(time()); $fileSync->save(); return $dbBatchJob; }