mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-07 15:19:31 +00:00
cd815acdbf
- Added new config entry job_type_permissions_white_list in jqm.php - Added new navigation entry jobsqueueviewer - Added new model application/models/system/JobsQueue_model.php - Added new option in FilterWidget for hours comparison with dates - Added new filter core-jq-lastHour to system/filtersupdate.php - Added new statements to system/dbupdate_3.3.php to create tables system.tbl_jobstatuses, system.tbl_jobtypes and system.tbl_jobstatuses - Added new views application/views/system/jq/jobsQueueViewer.php and application/views/system/jq/jobsQueueViewerData.php
64 lines
1.6 KiB
PHP
64 lines
1.6 KiB
PHP
<?php
|
|
|
|
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
|
|
|
/**
|
|
* Job Queue Worker
|
|
*
|
|
* This controller acts as interface of the JobsQueueLib that contains all the needed functionalities to operate with
|
|
* the Jobs Queue System
|
|
* This is an abstract class that provide basic functionalities, it has to be extended to broaden its logic
|
|
*/
|
|
abstract class JQW_Controller extends JOB_Controller
|
|
{
|
|
/**
|
|
* Constructor
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
// Loads LogLib with different parameters
|
|
$this->load->library('LogLib', array(
|
|
'classIndex' => 5,
|
|
'functionIndex' => 5,
|
|
'lineIndex' => 4,
|
|
'dbLogType' => 'job', // required
|
|
'dbExecuteUser' => 'Jobs queue system'
|
|
));
|
|
|
|
// Loads JobsQueueLib library
|
|
$this->load->library('JobsQueueLib');
|
|
}
|
|
|
|
//------------------------------------------------------------------------------------------------------------------
|
|
// Protected methods
|
|
|
|
/**
|
|
* To get all the most recently added jobs using the given job type
|
|
*/
|
|
protected function getLastJobs($type)
|
|
{
|
|
$jobs = $this->jobsqueuelib->getLastJobs($type);
|
|
|
|
// If an error occurred then log it in database
|
|
if (isError($jobs)) $this->logError(getError($jobs), $type);
|
|
|
|
return $jobs;
|
|
}
|
|
|
|
/**
|
|
* Add new jobs in the jobs queue with the given type
|
|
* jobs is an array of job objects
|
|
*/
|
|
protected function addNewJobsToQueue($type, $jobs)
|
|
{
|
|
$result = $this->jobsqueuelib->addNewJobsToQueue($type, $jobs);
|
|
|
|
// If an error occurred then log it in database
|
|
if (isError($result)) $this->logError(getError($result), $type);
|
|
|
|
return $result;
|
|
}
|
|
}
|