Example #1
0
 public static function addStorageDeleteJob(BatchJob $parentJob = null, $entryId = null, StorageProfile $storage, FileSync $fileSync)
 {
     $netStorageDeleteData = kStorageDeleteJobData::getInstance($storage->getProtocol());
     $netStorageDeleteData->setJobData($storage, $fileSync);
     if ($parentJob) {
         $batchJob = $parentJob->createChild(BatchJobType::STORAGE_DELETE, $storage->getProtocol(), false);
     } else {
         $batchJob = new BatchJob();
         $batchJob->setEntryId($entryId);
         $batchJob->setPartnerId($storage->getPartnerId());
     }
     $batchJob->setObjectId($fileSync->getId());
     $batchJob->setObjectType(BatchJobObjectType::FILE_SYNC);
     $batchJob->setJobSubType($storage->getProtocol());
     KalturaLog::log("Creating Net-Storage Delete job, with source file: " . $netStorageDeleteData->getSrcFileSyncLocalPath());
     return self::addJob($batchJob, $netStorageDeleteData, BatchJobType::STORAGE_DELETE, $storage->getProtocol());
 }
Example #2
0
 public static function handleStorageDeleteFinished(BatchJob $dbBatchJob, kStorageDeleteJobData $data)
 {
     $fileSync = FileSyncPeer::retrieveByPK($data->getSrcFileSyncId());
     if (!$fileSync) {
         KalturaLog::err("FileSync [" . $data->getSrcFileSyncId() . "] not found");
         return $dbBatchJob;
     }
     $fileSync->setStatus(FileSync::FILE_SYNC_STATUS_DELETED);
     $fileSync->save();
     return $dbBatchJob;
 }
Example #3
0
 public static function addStorageDeleteJob(BatchJob $parentJob, Partner $partner, FileSyncKey $syncKey)
 {
     $srcFileSyncLocalPath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
     $fileSync = kFileSyncUtils::getLocalFileSyncForKey($syncKey, false);
     $netStorageDeleteData = new kStorageDeleteJobData();
     $netStorageDeleteData->setServerUrl($partner->getStorageAddress());
     $netStorageDeleteData->setServerUsername($partner->getStorageUsername());
     $netStorageDeleteData->setServerPassword($partner->getStoragePassword());
     $netStorageDeleteData->setFtpPassiveMode($partner->getStorageFtpPassive());
     $netStorageDeleteData->setSrcFileSyncLocalPath($srcFileSyncLocalPath);
     $netStorageDeleteData->setSrcFileSyncId($fileSync->getId());
     $batchJob = $parentJob->createChild(false);
     KalturaLog::log("Creating Net-Storage Delete job, with source file: " . $netStorageDeleteData->getSrcFileSyncLocalPath());
     return self::addJob($batchJob, $netStorageDeleteData, BatchJobType::STORAGE_DELETE, $partner->getStorageProtocol());
 }
 public static function addStorageDeleteJob(BatchJob $parentJob = null, $entryId = null, StorageProfile $storage, FileSync $fileSync)
 {
     $netStorageDeleteData = new kStorageDeleteJobData();
     $netStorageDeleteData->setServerUrl($storage->getStorageUrl());
     $netStorageDeleteData->setServerUsername($storage->getStorageUsername());
     $netStorageDeleteData->setServerPassword($storage->getStoragePassword());
     $netStorageDeleteData->setFtpPassiveMode($storage->getStorageFtpPassiveMode());
     $netStorageDeleteData->setSrcFileSyncId($fileSync->getId());
     $netStorageDeleteData->setDestFileSyncStoredPath($storage->getStorageBaseDir() . '/' . $fileSync->getFilePath());
     if ($parentJob) {
         $batchJob = $parentJob->createChild(false);
     } else {
         $batchJob = new BatchJob();
         $batchJob->setEntryId($entryId);
         $batchJob->setPartnerId($storage->getPartnerId());
     }
     KalturaLog::log("Creating Net-Storage Delete job, with source file: " . $netStorageDeleteData->getSrcFileSyncLocalPath());
     return self::addJob($batchJob, $netStorageDeleteData, BatchJobType::STORAGE_DELETE, $storage->getProtocol());
 }
 public static function handleStorageDeleteFinished(BatchJob $dbBatchJob, kStorageDeleteJobData $data)
 {
     KalturaLog::debug("Remote storage file deletion finished for fileysnc ID:[ " . $data->getSrcFileSyncId() . "]");
     $fileSync = FileSyncPeer::retrieveByPK($data->getSrcFileSyncId());
     $fileSync->setStatus(FileSync::FILE_SYNC_STATUS_DELETED);
     $fileSync->save();
     return $dbBatchJob;
 }