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 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()); }