本文整理汇总了PHP中kJobsManager::addBulkUploadJob方法的典型用法代码示例。如果您正苦于以下问题:PHP kJobsManager::addBulkUploadJob方法的具体用法?PHP kJobsManager::addBulkUploadJob怎么用?PHP kJobsManager::addBulkUploadJob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kJobsManager
的用法示例。
在下文中一共展示了kJobsManager::addBulkUploadJob方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addXMLBulkUploadJob
/**
* Add bulk upload job
* @param DropFolder $folder
* @param DropFolderFile $leadDropFolderFile
* @throws Exception
*/
private function addXMLBulkUploadJob(DropFolder $folder, DropFolderFile $leadDropFolderFile)
{
/* @var $leadDropFolderFile FeedDropFolderFile */
KalturaLog::info('Adding BulkUpload job');
try {
$coreBulkUploadType = BulkUploadXmlPlugin::getBulkUploadTypeCoreValue(BulkUploadXmlType::XML);
$objectId = $leadDropFolderFile->getId();
$objectType = DropFolderXmlBulkUploadPlugin::getBatchJobObjectTypeCoreValue(DropFolderBatchJobObjectType::DROP_FOLDER_FILE);
$partner = PartnerPeer::retrieveByPK($folder->getPartnerId());
$data = KalturaPluginManager::loadObject('kBulkUploadJobData', $coreBulkUploadType);
/* @var $data kBulkUploadJobData */
$data->setUploadedBy(kDropFolderXmlEventsConsumer::UPLOADED_BY);
KalturaLog::info("Feed XML path: " . $leadDropFolderFile->getFeedXmlPath());
$data->setFilePath($leadDropFolderFile->getFeedXmlPath());
$data->setFileName(basename($data->getFilePath()) . '.xml');
$objectData = new kBulkUploadEntryData();
KalturaLog::info('Conversion profile id: ' . $folder->getConversionProfileId());
$objectData->setConversionProfileId($folder->getConversionProfileId());
$data->setObjectData($objectData);
$job = kJobsManager::addBulkUploadJob($partner, $data, $coreBulkUploadType, $objectId, $objectType);
$this->setFileToProcessing($leadDropFolderFile);
return $job;
} catch (Exception $e) {
KalturaLog::err("Error adding BulkUpload job -" . $e->getMessage());
throw new Exception(DropFolderXmlBulkUploadPlugin::ERROR_ADDING_BULK_UPLOAD_MESSAGE, DropFolderXmlBulkUploadPlugin::getErrorCodeCoreValue(DropFolderXmlBulkUploadErrorCode::ERROR_ADDING_BULK_UPLOAD));
}
}
示例2: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$fileField = "csv_file";
$profileId = $this->getP("profile_id");
if (count($_FILES) == 0) {
$this->addError(APIErrors::NO_FILES_RECEIVED);
return;
}
if (!@$_FILES[$fileField]) {
$this->addError(APIErrors::INVALID_FILE_FIELD, $fileField);
return;
}
// first we copy the file to "content/batchfiles/[partner_id]/"
$fileName = $_FILES[$fileField]['name'];
$filePath = $_FILES[$fileField]['tmp_name'];
$kuser = kuser::getKuserById($puser_kuser->getKuserId());
$partner = PartnerPeer::retrieveByPK($partner_id);
kJobsManager::addBulkUploadJob($filePath, $fileName, $partner, $kuser->getPuserId(), $kuser->getPuserId(), $profileId);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:19,代码来源:addbulkuploadAction.class.php
示例3: addAction
/**
* Add new bulk upload batch job
* Conversion profile id can be specified in the API or in the CSV file, the one in the CSV file will be stronger.
* If no conversion profile was specified, partner's default will be used
*
* @action add
* @param int $conversionProfileId Convertion profile id to use for converting the current bulk (-1 to use partner's default)
* @param file $csvFileData bulk upload file
* @param KalturaBulkUploadType $bulkUploadType
* @param string $uploadedBy
* @param string $fileName Friendly name of the file, used to be recognized later in the logs.
* @return KalturaBulkUpload
*/
public function addAction($conversionProfileId, $csvFileData, $bulkUploadType = null, $uploadedBy = null, $fileName = null)
{
if ($conversionProfileId == self::PARTNER_DEFAULT_CONVERSION_PROFILE_ID) {
$conversionProfileId = $this->getPartner()->getDefaultConversionProfileId();
}
$conversionProfile = conversionProfile2Peer::retrieveByPK($conversionProfileId);
if (!$conversionProfile) {
throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
}
$coreBulkUploadType = kPluginableEnumsManager::apiToCore('BulkUploadType', $bulkUploadType);
if (is_null($uploadedBy)) {
$uploadedBy = $this->getKuser()->getPuserId();
}
if (!$fileName) {
$fileName = $csvFileData["name"];
}
$data = $this->constructJobData($csvFileData["tmp_name"], $fileName, $this->getPartner(), $this->getKuser()->getPuserId(), $uploadedBy, $conversionProfileId, $coreBulkUploadType);
$dbJob = kJobsManager::addBulkUploadJob($this->getPartner(), $data, $coreBulkUploadType);
$dbJobLog = BatchJobLogPeer::retrieveByBatchJobId($dbJob->getId());
$bulkUpload = new KalturaBulkUpload();
$bulkUpload->fromObject($dbJobLog, $this->getResponseProfile());
return $bulkUpload;
}
示例4: addCategoryEntriesAction
/**
* @action addCategoryEntries
* @actionAlias categoryEntry.addFromBulkUpload
* Action adds active category entries
* @param KalturaBulkServiceData $bulkUploadData
* @param KalturaBulkUploadCategoryEntryData $bulkUploadCategoryEntryData
* @return KalturaBulkUpload
*/
public function addCategoryEntriesAction(KalturaBulkServiceData $bulkUploadData, KalturaBulkUploadCategoryEntryData $bulkUploadCategoryEntryData = null)
{
if ($bulkUploadData instanceof KalturaBulkServiceFilterData) {
if ($bulkUploadData->filter instanceof KalturaBaseEntryFilter) {
if ($bulkUploadData->filter->idEqual == null && $bulkUploadData->filter->idIn == null && $bulkUploadData->filter->categoriesIdsMatchOr == null && $bulkUploadData->filter->categoriesMatchAnd == null && $bulkUploadData->filter->categoriesMatchOr == null && $bulkUploadData->filter->categoriesIdsMatchAnd == null) {
throw new KalturaAPIException(KalturaErrors::MUST_FILTER_ON_ENTRY_OR_CATEGORY);
}
} else {
if ($bulkUploadData->filter instanceof KalturaCategoryEntryFilter) {
if ($bulkUploadData->filter->entryIdEqual == null && $bulkUploadData->filter->categoryIdIn == null && $bulkUploadData->filter->categoryIdEqual == null) {
throw new KalturaAPIException(KalturaErrors::MUST_FILTER_ON_ENTRY_OR_CATEGORY);
}
}
}
}
$bulkUploadJobData = KalturaPluginManager::loadObject('KalturaBulkUploadJobData', $bulkUploadData->getType());
$bulkUploadData->toBulkUploadJobData($bulkUploadJobData);
if (!$bulkUploadCategoryEntryData) {
$bulkUploadCategoryEntryData = new KalturaBulkUploadCategoryEntryData();
}
$dbBulkUploadJobData = $bulkUploadJobData->toInsertableObject();
$bulkUploadCoreType = kPluginableEnumsManager::apiToCore("BulkUploadType", $bulkUploadJobData->type);
$dbBulkUploadJobData->setBulkUploadObjectType(BulkUploadObjectType::CATEGORY_ENTRY);
$dbBulkUploadJobData->setUserId($this->getKuser()->getPuserId());
$dbObjectData = $bulkUploadCategoryEntryData->toInsertableObject();
$dbBulkUploadJobData->setObjectData($dbObjectData);
$dbJob = kJobsManager::addBulkUploadJob($this->getPartner(), $dbBulkUploadJobData, $bulkUploadCoreType);
$dbJobLog = BatchJobLogPeer::retrieveByBatchJobId($dbJob->getId());
if (!$dbJobLog) {
return null;
}
$bulkUpload = new KalturaBulkUpload();
$bulkUpload->fromObject($dbJobLog, $this->getResponseProfile());
return $bulkUpload;
}
示例5: addXMLBulkUploadJob
/**
* Add bulk upload job
* @param DropFolder $folder
* @param DropFolderFile $leadDropFolderFile
* @throws Exception
*/
private function addXMLBulkUploadJob(DropFolder $folder, DropFolderFile $leadDropFolderFile)
{
try {
$coreBulkUploadType = DropFolderXmlBulkUploadPlugin::getBulkUploadTypeCoreValue(DropFolderXmlBulkUploadType::DROP_FOLDER_XML);
$objectId = $leadDropFolderFile->getId();
$objectType = DropFolderXmlBulkUploadPlugin::getBatchJobObjectTypeCoreValue(DropFolderBatchJobObjectType::DROP_FOLDER_FILE);
$partner = PartnerPeer::retrieveByPK($folder->getPartnerId());
$data = KalturaPluginManager::loadObject('kBulkUploadJobData', $coreBulkUploadType);
$data->setUploadedBy(kDropFolderXmlEventsConsumer::UPLOADED_BY);
$data->setFileName($leadDropFolderFile->getFileName());
$objectData = new kBulkUploadEntryData();
$objectData->setConversionProfileId($folder->getConversionProfileId());
$data->setObjectData($objectData);
$job = kJobsManager::addBulkUploadJob($partner, $data, $coreBulkUploadType, $objectId, $objectType);
return $job;
} catch (Exception $e) {
KalturaLog::err("Error adding BulkUpload job -" . $e->getMessage());
throw new Exception(DropFolderXmlBulkUploadPlugin::ERROR_ADDING_BULK_UPLOAD_MESSAGE, DropFolderXmlBulkUploadPlugin::getErrorCodeCoreValue(DropFolderXmlBulkUploadErrorCode::ERROR_ADDING_BULK_UPLOAD));
}
}
示例6: addUsersAction
/**
* @action addUsers
* @actionAlias user.addFromBulkUpload
* Action adds users from a bulkupload CSV file
* @param file $fileData
* @param KalturaBulkUploadJobData $bulkUploadData
* @param KalturaBulkUploadUserData $bulkUploadUserData
* @return KalturaBulkUpload
*/
public function addUsersAction($fileData, KalturaBulkUploadJobData $bulkUploadData = null, KalturaBulkUploadUserData $bulkUploadUserData = null)
{
if (!$bulkUploadData) {
$bulkUploadData = KalturaPluginManager::loadObject('KalturaBulkUploadJobData', null);
}
if (!$bulkUploadUserData) {
$bulkUploadUserData = new KalturaBulkUploadUserData();
}
if (!$bulkUploadData->fileName) {
$bulkUploadData->fileName = $fileData["name"];
}
$dbBulkUploadJobData = $bulkUploadData->toInsertableObject();
$bulkUploadCoreType = kPluginableEnumsManager::apiToCore("BulkUploadType", $bulkUploadData->type);
$dbBulkUploadJobData->setBulkUploadObjectType(BulkUploadObjectType::USER);
$dbBulkUploadJobData->setUserId($this->getKuser()->getPuserId());
$dbObjectData = $bulkUploadUserData->toInsertableObject();
$dbBulkUploadJobData->setObjectData($dbObjectData);
$dbBulkUploadJobData->setFilePath($fileData["tmp_name"]);
$dbJob = kJobsManager::addBulkUploadJob($this->getPartner(), $dbBulkUploadJobData, $bulkUploadCoreType);
$dbJobLog = BatchJobLogPeer::retrieveByBatchJobId($dbJob->getId());
if (!$dbJobLog) {
return null;
}
$bulkUpload = new KalturaBulkUpload();
$bulkUpload->fromObject($dbJobLog);
return $bulkUpload;
}