Example #1
0
 public static function addBulkDownloadJob($partnerId, $puserId, $entryIds, $flavorParamsId)
 {
     $entryIds = explode(",", $entryIds);
     if (count($entryIds) > self::BULK_DOWNLOAD_TOTAL_ENTRIES_AMOUNT_RESTRICTION) {
         throw new APIException(APIErrors::ENTRIES_AMOUNT_EXCEEDED);
     }
     foreach ($entryIds as $entryId) {
         $dbEntry = entryPeer::retrieveByPK($entryId);
         if (!$dbEntry) {
             throw new APIException(APIErrors::INVALID_ENTRY_ID, $entryId);
         }
     }
     $chunksOfEntries = array_chunk($entryIds, self::BULK_DOWLOAD_SINGLE_JOB_ENTRIES_AMOUNT);
     KalturaLog::debug("about to create " . count($chunksOfEntries) . " jobs");
     $jobs = array();
     foreach ($chunksOfEntries as $chunk) {
         $jobDb = new BatchJob();
         $jobDb->setPartnerId($partnerId);
         $data = new kBulkDownloadJobData();
         $data->setEntryIds(implode(",", $chunk));
         $data->setFlavorParamsId($flavorParamsId);
         $data->setPuserId($puserId);
         $jobs[] = self::addJob($jobDb, $data, BatchJobType::BULKDOWNLOAD);
     }
     return $jobs;
 }
 public static function addBulkDownloadJob($partnerId, $puserId, $entryIds, $flavorParamsId)
 {
     $entryIds = explode(",", $entryIds);
     foreach ($entryIds as $entryId) {
         $dbEntry = entryPeer::retrieveByPK($entryId);
         if (!$dbEntry) {
             throw new APIException(APIErrors::INVALID_ENTRY_ID, $entryId);
         }
     }
     $jobDb = new BatchJob();
     $jobDb->setPartnerId($partnerId);
     $data = new kBulkDownloadJobData();
     $data->setEntryIds(implode(",", $entryIds));
     $data->setFlavorParamsId($flavorParamsId);
     $data->setPuserId($puserId);
     return self::addJob($jobDb, $data, BatchJobType::BULKDOWNLOAD);
 }