本文整理匯總了PHP中BatchJob::setExecutionStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP BatchJob::setExecutionStatus方法的具體用法?PHP BatchJob::setExecutionStatus怎麽用?PHP BatchJob::setExecutionStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BatchJob
的用法示例。
在下文中一共展示了BatchJob::setExecutionStatus方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: abortDbBatchJob
public static function abortDbBatchJob(BatchJob $dbBatchJob, $force = false)
{
// No need to abort finished job
if (in_array($dbBatchJob->getStatus(), BatchJobPeer::getClosedStatusList())) {
if ($force) {
$dbBatchJob->setExecutionStatus(BatchJobExecutionStatus::ABORTED);
$dbBatchJob->save();
}
return $dbBatchJob;
}
$lockObject = $dbBatchJob->getBatchJobLock();
if (is_null($lockObject)) {
KalturaLog::err("Batch job [" . $dbBatchJob->getId() . "] doesn't have a lock object and can't be deleted. Status (" . $dbBatchJob->getStatus() . ")");
return $dbBatchJob;
}
// Update status
$con = Propel::getConnection();
$update = new Criteria();
$update->add(BatchJobLockPeer::STATUS, BatchJob::BATCHJOB_STATUS_ABORTED);
$update->add(BatchJobLockPeer::VERSION, $lockObject->getVersion() + 1);
$updateCondition = new Criteria();
$updateCondition->add(BatchJobLockPeer::ID, $lockObject->getId(), Criteria::EQUAL);
$updateCondition->add(BatchJobLockPeer::VERSION, $lockObject->getVersion(), Criteria::EQUAL);
$updateCondition->add(BatchJobLockPeer::SCHEDULER_ID, null, Criteria::ISNULL);
$affectedRows = BasePeer::doUpdate($updateCondition, $update, $con);
if ($affectedRows) {
$dbBatchJob->setExecutionStatus(BatchJobExecutionStatus::ABORTED);
$dbBatchJob = self::updateBatchJob($dbBatchJob, BatchJob::BATCHJOB_STATUS_ABORTED);
} else {
$dbBatchJob->setExecutionStatus(BatchJobExecutionStatus::ABORTED);
$dbBatchJob->save();
}
self::abortChildJobs($dbBatchJob);
return $dbBatchJob;
}