mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-22 17:32:18 +00:00
First proposal
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
//
|
||||
$config['addable_jobs_black_list'] = array('doomsday', 'sudo rm -fR /', 'sudo mv / /dev/null');
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Jobs Queue Manager
|
||||
*/
|
||||
class JobsQueueMonitor extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'getJobsByType' => 'monitoring:r',
|
||||
'getJobsByStatus' => 'monitoring:r',
|
||||
'getJobsByCreationTime' => 'monitoring:r'
|
||||
)
|
||||
);
|
||||
|
||||
// Loads JobsQueueLib
|
||||
$this->load->library('JobsQueueLib');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getJobsByType()
|
||||
{
|
||||
$jobType = $this->input->get(JobsQueueLib::PARAM_JOB_TYPE);
|
||||
|
||||
$this->outputJson($this->jobsqueuelib->getJobsByType($jobType));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getJobsByStatus()
|
||||
{
|
||||
$jobStatus = $this->input->get(JobsQueueLib::PARAM_JOB_STATUS);
|
||||
|
||||
$this->outputJson($this->jobsqueuelib->getJobsByStatus($jobStatus));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getJobsByCreationTime()
|
||||
{
|
||||
$jobCreationTime = $this->input->get(JobsQueueLib::PARAM_JOB_CREATION_TIME);
|
||||
|
||||
$this->outputJson($this->jobsqueuelib->getJobsByCreationTime($jobCreationTime));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class JQW_Controller extends JOB_Controller
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads LogLib with different ...
|
||||
$this->load->library('LogLib', array(
|
||||
'classIndex' => 5,
|
||||
'functionIndex' => 5,
|
||||
'lineIndex' => 4,
|
||||
'dbLogType' => 'job', // required
|
||||
'dbExecuteUser' => 'Jobs queue system'
|
||||
));
|
||||
|
||||
// Loads JobsQueueLib
|
||||
$this->load->library('JobsQueueLib');
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------
|
||||
// Protected methods to read/write the jobs queue
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function getJobsByType($jobType)
|
||||
{
|
||||
$jobs = $this->jobsqueuelib->getJobsByType($jobType);
|
||||
|
||||
if (isError($jobs)) $this->logError(getError($jobs), $jobType);
|
||||
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function addNewJobsToQueue($jobType, $jobs)
|
||||
{
|
||||
$result = $this->jobsqueuelib->addNewJobsToQueue($jobType, $jobs);
|
||||
|
||||
if (isError($result)) $this->logError(getError($result), $jobType);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class JobsQueueLib
|
||||
{
|
||||
//
|
||||
const STATUS_RUNNING = 'running';
|
||||
const STATUS_NEW = 'new';
|
||||
const STATUS_DONE = 'done';
|
||||
|
||||
//
|
||||
const PARAM_JOB_TYPE = 'jobType';
|
||||
const PARAM_JOB_STATUS = 'jobStatus';
|
||||
const PARAM_JOB_CREATION_TIME = 'jobCreatinTime';
|
||||
|
||||
//
|
||||
const JOB_TYPE_SAP_STAMMDATEN_UPDATE = 'SAPStammdatenUpdate';
|
||||
const JOB_TYPE_SAP_PAYMENT = 'SAPPayment';
|
||||
const JOB_TYPE_OEH_PAYMENT = 'OEHPayment';
|
||||
|
||||
private $_ci; // CI instance
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public function __construct($authenticate = true)
|
||||
{
|
||||
// Gets CI instance
|
||||
$this->_ci =& get_instance();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getJobsByType()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function addNewJobsToQueue()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getJobsByStatus()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user