mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-22 17:32:18 +00:00
- Added new protected method getOldestJob to JQW_Controller
- Added new public method getOldestJob to JobsQueueLib
This commit is contained in:
@@ -47,6 +47,19 @@ abstract class JQW_Controller extends JOB_Controller
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* To get the oldest added job using the given job type
|
||||
*/
|
||||
protected function getOldestJob($type)
|
||||
{
|
||||
$jobs = $this->jobsqueuelib->getOldestJob($type);
|
||||
|
||||
// If an error occurred then log it in database
|
||||
if (isError($jobs)) $this->logError(getError($jobs), $type);
|
||||
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* To get all the jobs specified by the given parameters
|
||||
*/
|
||||
|
||||
@@ -56,6 +56,19 @@ class JobsQueueLib
|
||||
return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type));
|
||||
}
|
||||
|
||||
/**
|
||||
* To get the oldest added jobs using the given job type
|
||||
*/
|
||||
public function getOldestJob($type)
|
||||
{
|
||||
$this->_ci->JobsQueueModel->resetQuery();
|
||||
|
||||
$this->_ci->JobsQueueModel->addOrder('creationtime', 'ASC');
|
||||
$this->_ci->JobsQueueModel->addLimit('1');
|
||||
|
||||
return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type));
|
||||
}
|
||||
|
||||
/**
|
||||
* To get all the jobs specified by the given parameters
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user