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


PHP BatchJobPeer::doCount方法代码示例

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


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

示例1: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     // TODO -  verify permissions for viewing lists
     $detailed = $this->getP("detailed", false);
     $limit = $this->getP("page_size", 10);
     $page = $this->getP("page", 1);
     //$order_by = int( $this->getP ( "order_by" , -1 ) );
     $offset = ($page - 1) * $limit;
     $c = new Criteria();
     $download_types = array(BatchJobType::FLATTEN, BatchJobType::DOWNLOAD);
     $c->add(BatchJobPeer::JOB_TYPE, $download_types, Criteria::IN);
     // filter
     $filter = new BatchJobFilter(true);
     $fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
     $filter->attachToCriteria($c);
     //if ($order_by != -1) kshowPeer::setOrder( $c , $order_by );
     $count = BatchJobPeer::doCount($c);
     $offset = ($page - 1) * $limit;
     $c->setLimit($limit);
     if ($offset > 0) {
         $c->setOffset($offset);
     }
     $list = BatchJobPeer::doSelect($c);
     $level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $this->addMsg("count", $count);
     $this->addMsg("page_size", $limit);
     $this->addMsg("page", $page);
     $wrapper = objectWrapperBase::getWrapperClass($list, $level);
     $this->addMsg("downloads", $wrapper);
 }
开发者ID:DBezemer,项目名称:server,代码行数:30,代码来源:listdownloadsAction.class.php

示例2: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $limit = $this->getP("page_size", 20);
     $limit = min($limit, 100);
     $page = $this->getP("page", 1);
     $offset = ($page - 1) * $limit;
     $c = new Criteria();
     $c->addAnd(BatchJobPeer::PARTNER_ID, $partner_id);
     $c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
     $c->addDescendingOrderByColumn(BatchJobPeer::ID);
     $count = BatchJobPeer::doCount($c);
     $c->setLimit($limit);
     $c->setOffset($offset);
     $jobs = BatchJobPeer::doSelect($c);
     $obj = array();
     foreach ($jobs as $job) {
         $jobData = $job->getData();
         if (!$jobData instanceof kBulkUploadJobData) {
             continue;
         }
         $bulkResults = BulkUploadResultPeer::retrieveWithEntryByBulkUploadId($job->getId());
         $obj[] = array("uploadedBy" => $jobData->getUploadedBy(), "uploadedOn" => $job->getCreatedAt(null), "numOfEntries" => count($bulkResults), "status" => $job->getStatus(), "error" => $job->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED ? $job->getMessage() : '', "logFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/log", "csvFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/csv");
     }
     $this->addMsg("count", $count);
     $this->addMsg("page_size", $limit);
     $this->addMsg("page", $page);
     $this->addMsg("bulk_uploads", $obj);
 }
开发者ID:DBezemer,项目名称:server,代码行数:28,代码来源:listbulkuploadsAction.class.php

示例3: explode

$flavorParamsArr = null;
if (!is_null($flavorParamsIds) && strlen(trim($flavorParamsIds))) {
    $flavorParamsArr = explode(',', $flavorParamsIds);
}
$moreEntries = true;
$maxConcurrentJobs = 20;
$totalExported = 0;
$lastCreatedAt = null;
$processedIds = array();
$nonFinalBatchStatuses = array(BatchJob::BATCHJOB_STATUS_PENDING, BatchJob::BATCHJOB_STATUS_QUEUED, BatchJob::BATCHJOB_STATUS_PROCESSING, BatchJob::BATCHJOB_STATUS_PROCESSED, BatchJob::BATCHJOB_STATUS_MOVEFILE);
while ($moreEntries) {
    $c = new Criteria();
    $c->addAnd(BatchJobPeer::PARTNER_ID, $partnerId);
    $c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::STORAGE_EXPORT);
    $c->addAnd(BatchJobPeer::STATUS, $nonFinalBatchStatuses, Criteria::IN);
    $batchCount = BatchJobPeer::doCount($c, false, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL3));
    if ($batchCount >= $maxConcurrentJobs) {
        sleep(30);
        continue;
    }
    $curLimit = $maxConcurrentJobs - $batchCount;
    $currentExported = 0;
    $c = new Criteria();
    $c->add(entryPeer::PARTNER_ID, $partnerId);
    if ($lastCreatedAt) {
        $c->addAnd(entryPeer::CREATED_AT, $lastCreatedAt, Criteria::LESS_EQUAL);
    }
    $c->addDescendingOrderByColumn(entryPeer::CREATED_AT);
    $c->setLimit($curLimit);
    $entries = entryPeer::doSelect($c, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL3));
    foreach ($entries as $entry) {
开发者ID:DBezemer,项目名称:server,代码行数:31,代码来源:exportToNetStorage.php

示例4: freeExclusiveJobAction

 /**
  * batch freeExclusiveJobAction action allows to get a generic BatchJob 
  * 
  * @action freeExclusiveJob
  * @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  
  * @param bool $resetExecutionAttempts Resets the job execution attampts to zero  
  * @return KalturaFreeJobResponse 
  */
 function freeExclusiveJobAction($id, KalturaExclusiveLockKey $lockKey, $jobType, $resetExecutionAttempts = false)
 {
     $jobType = kPluginableEnumsManager::apiToCore('BatchJobType', $jobType);
     $job = BatchJobPeer::retrieveByPK($id);
     // verifies that the job is of the right type
     if ($job->getJobType() != $jobType) {
         throw new KalturaAPIException(APIErrors::UPDATE_EXCLUSIVE_JOB_WRONG_TYPE, $id, $lockKey, null);
     }
     $job = kBatchManager::freeExclusiveBatchJob($id, $lockKey->toObject(), $resetExecutionAttempts);
     $batchJob = new KalturaBatchJob();
     // start from blank
     $batchJob->fromObject($job);
     // gets queues length
     $c = new Criteria();
     $c->add(BatchJobPeer::STATUS, array(KalturaBatchJobStatus::PENDING, KalturaBatchJobStatus::RETRY, KalturaBatchJobStatus::ALMOST_DONE), Criteria::IN);
     $c->add(BatchJobPeer::JOB_TYPE, $jobType);
     $queueSize = BatchJobPeer::doCount($c, false, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
     if (!$queueSize) {
         // gets queues length
         $c = new Criteria();
         $c->add(BatchJobPeer::BATCH_INDEX, null, Criteria::ISNOTNULL);
         $c->add(BatchJobPeer::PROCESSOR_EXPIRATION, time(), Criteria::GREATER_THAN);
         $c->add(BatchJobPeer::EXECUTION_ATTEMPTS, BatchJobPeer::getMaxExecutionAttempts($jobType), Criteria::LESS_THAN);
         $c->add(BatchJobPeer::JOB_TYPE, $jobType);
         $queueSize = BatchJobPeer::doCount($c, false, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
     }
     $response = new KalturaFreeJobResponse();
     $response->job = $batchJob;
     $response->jobType = $jobType;
     $response->queueSize = $queueSize;
     return $response;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:42,代码来源:BatchService.php

示例5: listBatchJobsAction

 /**
  * list Batch Jobs 
  * 
  * @action listBatchJobs
  * @param KalturaBatchJobFilter $filter
  * @param KalturaFilterPager $pager  
  * @return KalturaBatchJobListResponse
  */
 function listBatchJobsAction(KalturaBatchJobFilter $filter = null, KalturaFilterPager $pager = null)
 {
     if (!$filter) {
         $filter = new KalturaBatchJobFilter();
     }
     $batchJobFilter = new BatchJobFilter();
     $filter->toObject($batchJobFilter);
     $c = new Criteria();
     //		$c->add(BatchJobPeer::DELETED_AT, null);
     $batchJobFilter->attachToCriteria($c);
     if (!$pager) {
         $pager = new KalturaFilterPager();
     }
     $pager->attachToCriteria($c);
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
     $list = BatchJobPeer::doSelect($c);
     $c->setLimit(false);
     $count = BatchJobPeer::doCount($c);
     $newList = KalturaBatchJobArray::fromStatisticsBatchJobArray($list);
     $response = new KalturaBatchJobListResponse();
     $response->objects = $newList;
     $response->totalCount = $count;
     return $response;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:32,代码来源:JobsService.php

示例6: countBatchJobs

 /**
  * Returns the number of related BatchJob objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related BatchJob objects.
  * @throws     PropelException
  */
 public function countBatchJobs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(BatchJobLockPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collBatchJobs === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(BatchJobPeer::BATCH_JOB_LOCK_ID, $this->id);
             $count = BatchJobPeer::doCount($criteria, false, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return count of the collection.
             $criteria->add(BatchJobPeer::BATCH_JOB_LOCK_ID, $this->id);
             if (!isset($this->lastBatchJobCriteria) || !$this->lastBatchJobCriteria->equals($criteria)) {
                 $count = BatchJobPeer::doCount($criteria, false, $con);
             } else {
                 $count = count($this->collBatchJobs);
             }
         } else {
             $count = count($this->collBatchJobs);
         }
     }
     return $count;
 }
开发者ID:DBezemer,项目名称:server,代码行数:45,代码来源:BaseBatchJobLock.php

示例7: getQueue

 private static function getQueue(Criteria $c, $schedulerId, $workerId, $max_exe_attempts)
 {
     $schd = BatchJobPeer::SCHEDULER_ID;
     $work = BatchJobPeer::WORKER_ID;
     $stat = BatchJobPeer::STATUS;
     $atmp = BatchJobPeer::EXECUTION_ATTEMPTS;
     $expr = BatchJobPeer::PROCESSOR_EXPIRATION;
     $recheck = BatchJobPeer::CHECK_AGAIN_TIMEOUT;
     $schd_id = $schedulerId;
     $work_id = $workerId;
     $now = time();
     $now_str = date('Y-m-d H:i:s', $now);
     // same workers unfinished jobs
     $query1 = "(\r\n\t\t\t\t\t\t\t{$schd} = {$schd_id} \r\n\t\t\t\t\t\tAND {$work} = {$work_id} \r\n\t\t\t\t\t\tAND {$stat} IN (" . BatchJobPeer::getInProcStatusList() . ") \r\n\t\t\t\t\t)";
     //	"others unfinished jobs " - the expiration should be SMALLER than the current time to make sure the job is not
     // being processed
     $closedStatuses = implode(',', BatchJobPeer::getClosedStatusList());
     $query2 = "(\r\n\t\t\t\t\t\t\t{$stat} NOT IN ({$closedStatuses})\r\n\t\t\t\t\t\tAND\t{$expr} <= '{$now_str}'\r\n\t\t\t\t\t)";
     // "retry jobs"
     $query3 = "(\r\n\t\t\t\t\t\t{$stat} = " . BatchJob::BATCHJOB_STATUS_RETRY . "\r\n\t\t\t\t\t\tAND {$recheck} <= {$now}\r\n\t\t\t\t\t)";
     // "max attempts jobs"
     $queryMaxAttempts = "(\r\n\t\t\t\t\t\t\t\t{$atmp} <= {$max_exe_attempts}\r\n\t\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\t\t{$atmp} IS NULL\r\n\t\t\t\t\t\t\t)";
     $crit1 = $c->getNewCriterion($stat, BatchJob::BATCHJOB_STATUS_PENDING);
     $crit1->addOr($c->getNewCriterion($schd, $query1, Criteria::CUSTOM));
     $crit1->addOr($c->getNewCriterion($schd, $query2, Criteria::CUSTOM));
     $crit1->addOr($c->getNewCriterion($schd, $query3, Criteria::CUSTOM));
     $c->addAnd($crit1);
     $c->addAnd($c->getNewCriterion($atmp, $queryMaxAttempts, Criteria::CUSTOM));
     $c->addAnd($c->getNewCriterion(BatchJobPeer::DC, kDataCenterMgr::getCurrentDcId()));
     //		$objects = BatchJobPeer::doCount ( $c );
     return BatchJobPeer::doCount($c, false, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:32,代码来源:kBatchExclusiveLock.class.php

示例8: listAction

 /**
  * List bulk upload batch jobs
  *
  * @action list
  * @param KalturaFilterPager $pager
  * @return KalturaBulkUploadListResponse
  */
 function listAction(KalturaFilterPager $pager = null)
 {
     if (!$pager) {
         $pager = new KalturaFilterPager();
     }
     $c = new Criteria();
     $c->addAnd(BatchJobPeer::PARTNER_ID, $this->getPartnerId());
     $c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
     $c->addDescendingOrderByColumn(BatchJobPeer::ID);
     $count = BatchJobPeer::doCount($c);
     $pager->attachToCriteria($c);
     $jobs = BatchJobPeer::doSelect($c);
     $response = new KalturaBulkUploadListResponse();
     $response->objects = KalturaBulkUploads::fromBatchJobArray($jobs);
     $response->totalCount = $count;
     return $response;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:24,代码来源:BulkUploadService.php


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