当前位置: 首页>>代码示例>>PHP>>正文


PHP BatchJobPeer::doSelectOne方法代码示例

本文整理汇总了PHP中BatchJobPeer::doSelectOne方法的典型用法代码示例。如果您正苦于以下问题:PHP BatchJobPeer::doSelectOne方法的具体用法?PHP BatchJobPeer::doSelectOne怎么用?PHP BatchJobPeer::doSelectOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BatchJobPeer的用法示例。


在下文中一共展示了BatchJobPeer::doSelectOne方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute()
 {
     $jobId = $this->getRequestParameter("id");
     $partnerId = $this->getRequestParameter("pid");
     $type = $this->getRequestParameter("type");
     $c = new Criteria();
     $c->addAnd(BatchJobPeer::ID, $jobId);
     $c->addAnd(BatchJobPeer::PARTNER_ID, $partnerId);
     $c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
     $batchJob = BatchJobPeer::doSelectOne($c);
     if (!$batchJob) {
         die("File not found");
     }
     header("Content-Type: text/plain; charset=UTF-8");
     if ($type == "log") {
         $bulkUploadResults = BulkUploadResultPeer::retrieveByBulkUploadId($jobId);
         if (!count($bulkUploadResults)) {
             $syncKey = $batchJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOADLOG);
             if (kFileSyncUtils::file_exists($syncKey, true)) {
                 $content = kFileSyncUtils::file_get_contents($syncKey, true);
                 echo $content;
                 die;
             }
             die("Log file is not ready");
         }
         $STDOUT = fopen('php://output', 'w');
         $data = $batchJob->getData();
         foreach ($bulkUploadResults as $bulkUploadResult) {
             $values = array($bulkUploadResult->getTitle(), $bulkUploadResult->getDescription(), $bulkUploadResult->getTags(), $bulkUploadResult->getUrl(), $bulkUploadResult->getContentType());
             if ($data instanceof kBulkUploadJobData && $data->getCsvVersion() > kBulkUploadJobData::BULK_UPLOAD_CSV_VERSION_V1) {
                 $values[] = $bulkUploadResult->getConversionProfileId();
                 $values[] = $bulkUploadResult->getAccessControlProfileId();
                 $values[] = $bulkUploadResult->getCategory();
                 $values[] = $bulkUploadResult->getScheduleStartDate('Y-m-d\\TH:i:s');
                 $values[] = $bulkUploadResult->getScheduleEndDate('Y-m-d\\TH:i:s');
                 $values[] = $bulkUploadResult->getThumbnailUrl();
                 $values[] = $bulkUploadResult->getPartnerData();
             }
             $values[] = $bulkUploadResult->getEntryId();
             $values[] = $bulkUploadResult->getEntryStatus();
             $values[] = $bulkUploadResult->getErrorDescription();
             fputcsv($STDOUT, $values);
         }
         fclose($STDOUT);
     } else {
         $syncKey = $batchJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOADCSV);
         if (kFileSyncUtils::file_exists($syncKey, true)) {
             $content = kFileSyncUtils::file_get_contents($syncKey, true);
             echo $content;
             die;
         } else {
             die("File not found");
         }
     }
     die;
     //  no template needed
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:57,代码来源:bulkuploadfileAction.class.php

示例2: getAction

 /**
  * Get bulk upload batch job by id
  *
  * @action get
  * @param int $id
  * @return KalturaBulkUpload
  */
 function getAction($id)
 {
     $c = new Criteria();
     $c->addAnd(BatchJobPeer::ID, $id);
     $c->addAnd(BatchJobPeer::PARTNER_ID, $this->getPartnerId());
     $c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
     $batchJob = BatchJobPeer::doSelectOne($c);
     if (!$batchJob) {
         throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_NOT_FOUND, $id);
     }
     $ret = new KalturaBulkUpload();
     $ret->fromObject($batchJob);
     return $ret;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:21,代码来源:BulkUploadService.php

示例3: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $job_type = $this->getPM("job_type");
     $processor_name = $this->getPM("processor_name");
     $processor_timeout = $this->getPM("processor_timeout");
     $over_quota_partners = $this->getPM("over_quota_partners");
     $defered_partners = $this->getPM("defered_partners");
     $con = Propel::getConnection();
     // fetch one pending row of a given job_type
     // where the over_quota_partner requests are dropped
     // and defered_partners request are of less priority
     $query = "SELECT " . BatchJobPeer::ID . " FROM " . BatchJobPeer::TABLE_NAME . " WHERE " . BatchJobPeer::STATUS . "=" . BatchJob::BATCHJOB_STATUS_PENDING . " AND " . BatchJobPeer::JOB_TYPE . "=" . $job_type . " " . (count($over_quota_partners) ? " AND " . BatchJobPeer::PARTNER_ID . " NOT IN ({$over_quota_partners}) " : "") . " ORDER BY " . (count($defered_partners) ? BatchJobPeer::PARTNER_ID . " IN ({$defered_partners}), " : "") . BatchJobPeer::CREATED_AT . " LIMIT 1";
     $statement = $con->prepareStatement($query);
     $resultset = $statement->executeQuery();
     $batch_job = null;
     while ($resultset->next()) {
         $batch_job = BatchJobPeer::retrieveByPK($resultset->getInt('ID'));
     }
     $batch_job = BatchJobPeer::doSelectOne($c);
     if ($batch_job) {
         // force update to work on the currently selected row and ensure it is still in pending status
         $c->add(BatchJobPeer::ID, $batch_job->getId());
         $c->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_PENDING);
         $update = new Criteria();
         $update->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_QUEUED);
         $update->add(BatchJobPeer::PROCESSOR_NAME, $processor_name);
         $update->add(BatchJobPeer::PROCESSOR_EXPIRATION, time() + $processor_timeout);
         $affectedRows = BasePeer::doUpdate($c, $update, $con);
         if ($affectedRows != 1) {
             $batch_job = null;
         }
     }
     if (!$batch_job) {
         //xx$this->addError ( APIErrors::INVALID_ENTRY_ID, $this->getObjectPrefix() , $entry_id );
     } else {
         $wrapper = objectWrapperBase::getWrapperClass($batch_job, objectWrapperBase::DETAIL_LEVEL_REGULAR);
         // TODO - remove this code when cache works properly when saving objects (in their save method)
         $wrapper->removeFromCache("batch_job", $batch_job->getId());
         $this->addMsg("batchjob", $wrapper);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:41,代码来源:queuependingbatchjobAction.class.php

示例4: getImportInfo

 public function getImportInfo()
 {
     if ($this->getStatus() == entryStatus::IMPORT) {
         $c = new Criteria();
         $c->add(BatchJobPeer::ENTRY_ID, $this->getId());
         $c->addDescendingOrderByColumn(BatchJobPeer::ID);
         $import = BatchJobPeer::doSelectOne($c);
         return $import;
     }
     return null;
 }
开发者ID:AdiTal,项目名称:server,代码行数:11,代码来源:entry.php

示例5: resetJobExecutionAttemptsAction

 /**
  * batch resetJobExecutionAttempts action resets the execution attempts of the job 
  * 
  * @action resetJobExecutionAttempts
  * @param int $id The id of the job
  * @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism
  * @param KalturaBatchJobType $jobType The type of the job  
  * @throws KalturaErrors::UPDATE_EXCLUSIVE_JOB_FAILED
  * @throws KalturaErrors::UPDATE_EXCLUSIVE_JOB_WRONG_TYPE
  */
 function resetJobExecutionAttemptsAction($id, KalturaExclusiveLockKey $lockKey, $jobType)
 {
     $jobType = kPluginableEnumsManager::apiToCore('BatchJobType', $jobType);
     $c = new Criteria();
     $c->add(BatchJobPeer::ID, $id);
     $c->add(BatchJobPeer::SCHEDULER_ID, $lockKey->schedulerId);
     $c->add(BatchJobPeer::WORKER_ID, $lockKey->workerId);
     $c->add(BatchJobPeer::BATCH_INDEX, $lockKey->batchIndex);
     $job = BatchJobPeer::doSelectOne($c);
     if (!$job) {
         throw new KalturaAPIException(KalturaErrors::UPDATE_EXCLUSIVE_JOB_FAILED, $id, $lockKey->schedulerId, $lockKey->workerId, $lockKey->batchIndex);
     }
     // verifies that the job is of the right type
     if ($job->getJobType() != $jobType) {
         throw new KalturaAPIException(KalturaErrors::UPDATE_EXCLUSIVE_JOB_WRONG_TYPE, $id, $lockKey, null);
     }
     $job->setExecutionAttempts(0);
     $job->save();
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:29,代码来源:BatchService.php

示例6: getParentJobForWaitingAssetConversion

 private static function getParentJobForWaitingAssetConversion($entryId, BatchJob $parentJob = null)
 {
     if ($parentJob && $parentJob->getJobType() == BatchJobType::POSTCONVERT) {
         //In case the flavor conversion is triggered by the ingested flavor add the conversion job
         //under the convert profile job if available
         $c = new Criteria();
         $c->add(BatchJobPeer::ENTRY_ID, $entryId);
         $c->add(BatchJobPeer::JOB_TYPE, BatchJobType::CONVERT_PROFILE);
         $statuses = BatchJobPeer::getUnClosedStatusList();
         $statuses[] = BatchJob::BATCHJOB_STATUS_ALMOST_DONE;
         $c->add(BatchJobPeer::STATUS, $statuses, Criteria::IN);
         $batchJob = BatchJobPeer::doSelectOne($c);
         if ($batchJob) {
             return $batchJob;
         }
     }
     return $parentJob;
 }
开发者ID:DBezemer,项目名称:server,代码行数:18,代码来源:kBusinessPreConvertDL.php

示例7: freeExclusive

 /**
  * 
  * @param $id
  * @param kExclusiveLockKey $lockKey
  * @param $pending_status - optional. will be used to set the status once the object is free 
  * @return BatchJob
  */
 public static function freeExclusive($id, kExclusiveLockKey $lockKey, $resetExecutionAttempts = false)
 {
     $c = new Criteria();
     $c->add(BatchJobPeer::ID, $id);
     $c->add(BatchJobPeer::SCHEDULER_ID, $lockKey->getSchedulerId());
     $c->add(BatchJobPeer::WORKER_ID, $lockKey->getWorkerId());
     $c->add(BatchJobPeer::BATCH_INDEX, $lockKey->getBatchIndex());
     $db_object = BatchJobPeer::doSelectOne($c);
     if (!$db_object) {
         throw new APIException(APIErrors::FREE_EXCLUSIVE_JOB_FAILED, $id, $lockKey->getSchedulerId(), $lockKey->getWorkerId(), $lockKey->getBatchIndex());
     }
     if ($resetExecutionAttempts) {
         $db_object->setExecutionAttempts(0);
     }
     $db_object->setSchedulerId(null);
     $db_object->setWorkerId(null);
     $db_object->setBatchIndex(null);
     $db_object->setProcessorExpiration(null);
     $db_object->save();
     if ($db_object->getStatus() != BatchJob::BATCHJOB_STATUS_ABORTED && $db_object->getAbort()) {
         $db_object = kJobsManager::abortDbBatchJob($db_object);
     }
     return $db_object;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:31,代码来源:kBatchExclusiveLock.class.php

示例8: abortAction

 /**
  * Aborts the bulk upload and all its child jobs
  * 
  * @action abort
  * @param int $id job id
  * @return KalturaBulkUpload
  */
 function abortAction($id)
 {
     $c = new Criteria();
     $c->addAnd(BatchJobPeer::ID, $id);
     $c->addAnd(BatchJobPeer::PARTNER_ID, $this->getPartnerId());
     $c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
     $batchJob = BatchJobPeer::doSelectOne($c);
     if (!$batchJob) {
         throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_NOT_FOUND, $id);
     }
     kJobsManager::abortJob($id, BatchJobType::BULKUPLOAD, true);
     $batchJobLog = BatchJobLogPeer::retrieveByBatchJobId($id);
     $ret = new KalturaBulkUpload();
     if ($batchJobLog) {
         $ret->fromObject($batchJobLog, $this->getResponseProfile());
     }
     return $ret;
 }
开发者ID:DBezemer,项目名称:server,代码行数:25,代码来源:BulkService.php

示例9: activateConvertProfileJob

 private static function activateConvertProfileJob($entryId, $localFilePath)
 {
     $c = new Criteria();
     $c->add(BatchJobPeer::ENTRY_ID, $entryId);
     $c->add(BatchJobPeer::JOB_TYPE, BatchJobType::CONVERT_PROFILE);
     $c->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_DONT_PROCESS);
     $batchJob = BatchJobPeer::doSelectOne($c);
     if ($batchJob) {
         $data = $batchJob->getData();
         $data->setInputFileSyncLocalPath($localFilePath);
         $batchJob->setData($data);
         kJobsManager::updateBatchJob($batchJob, BatchJob::BATCHJOB_STATUS_PENDING);
         return true;
     } else {
         return false;
     }
 }
开发者ID:GElkayam,项目名称:server,代码行数:17,代码来源:kFlowHelper.php

示例10: resetFeaturesStatusByType

 public function resetFeaturesStatusByType($type)
 {
     $openStatuses = array(BatchJob::BATCHJOB_STATUS_ALMOST_DONE, BatchJob::BATCHJOB_STATUS_RETRY, BatchJob::BATCHJOB_STATUS_PENDING, BatchJob::BATCHJOB_STATUS_QUEUED, BatchJob::BATCHJOB_STATUS_PROCESSING, BatchJob::BATCHJOB_STATUS_PROCESSED, BatchJob::BATCHJOB_STATUS_MOVEFILE);
     $criteria = new Criteria();
     $criteria->add(BatchJobPeer::PARTNER_ID, $this->getId());
     $criteria->add(BatchJobPeer::JOB_TYPE, BatchJobType::INDEX);
     $criteria->add(BatchJobPeer::JOB_SUB_TYPE, $type);
     $criteria->add(BatchJobPeer::STATUS, $openStatuses, Criteria::IN);
     $batchJob = BatchJobPeer::doSelectOne($criteria);
     $featuresStatuses = $this->getFeaturesStatus();
     if ($batchJob) {
         $newFeatureStatus = new kFeatureStatus();
         $newFeatureStatus->setType($type);
         $newFeatureStatus->setValue(1);
         $featuresStatuses[$type] = $newFeatureStatus;
     } elseif (isset($featuresStatuses[$type])) {
         unset($featuresStatuses[$type]);
     }
     $this->setFeaturesStatus($featuresStatuses);
     $this->setUpdatedAt(time());
     $this->save();
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:22,代码来源:Partner.php

示例11: abortAction

 /**
  * Aborts the bulk upload and all its child jobs
  * 
  * @action abort
  * @param bigint $id job id
  * @return KalturaBulkUpload
  */
 public function abortAction($id)
 {
     $c = new Criteria();
     $c->addAnd(BatchJobPeer::ID, $id);
     $c->addAnd(BatchJobPeer::PARTNER_ID, $this->getPartnerId());
     $c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
     $batchJob = BatchJobPeer::doSelectOne($c);
     if (!$batchJob) {
         $c = new Criteria();
         $c->addAnd(BatchJobLogPeer::JOB_ID, $id);
         $c->addAnd(BatchJobLogPeer::PARTNER_ID, $this->getPartnerId());
         $c->addAnd(BatchJobLogPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
         $crit = $c->getNewCriterion(BatchJobLogPeer::ABORT, null);
         $critOr = $c->getNewCriterion(BatchJobLogPeer::ABORT, 0);
         $crit->addOr($critOr);
         $c->add($crit);
         $batchJobLog = BatchJobLogPeer::doSelectOne($c);
         if (!$batchJobLog) {
             throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_NOT_FOUND, $id);
         }
         $batchJobLog->setAbort(BatchJobExecutionStatus::ABORTED);
         $batchJobLog->save();
     } else {
         kJobsManager::abortJob($id, BatchJobType::BULKUPLOAD, true);
     }
     $batchJobLog = BatchJobLogPeer::retrieveByBatchJobId($id);
     $ret = new KalturaBulkUpload();
     $ret->fromObject($batchJobLog, $this->getResponseProfile());
     return $ret;
 }
开发者ID:dozernz,项目名称:server,代码行数:37,代码来源:BulkUploadService.php


注:本文中的BatchJobPeer::doSelectOne方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。