mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 08:34:29 +00:00
- Added new core controller JOB_Controller
- Added new webservicetyp_kurzbz "job" to table system.tbl_webservicetyp in system/dbupdate_3.3.php - Added new filter "All jobs viewer" - Added new __construct to LogLib to set properties - Added new public methods logInfoDB, logDebugDB, logWarningDB and logErrorDB to LogLib - Added new private method _logDB to LogLib - Renamed LogLib private method _format to _getPrefix - Added new private method _getDatabaseDescription to LogLib - Changed method _getCaller to use different levels of debug_backtrace - Added new properties and constants to LogLib to log to the database
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* REST_Controller takes care about authentication and it loads the AuthLib
|
||||
*/
|
||||
class APIv1_Controller extends REST_Controller
|
||||
abstract class APIv1_Controller extends REST_Controller
|
||||
{
|
||||
private $_requiredPermissions;
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Auth_Controller extends FHC_Controller
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class Auth_Controller extends FHC_Controller
|
||||
{
|
||||
/**
|
||||
* Extends this controller if authentication is required
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class CLI_Controller extends FHC_Controller
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class CLI_Controller extends FHC_Controller
|
||||
{
|
||||
const INFO_FORMAT = '%s %s %s %s'; // Info message format
|
||||
const REQUIRED_PARAM_FORMAT = ' %s'; // Info message required method parameter format
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DB_Model extends CI_Model
|
||||
{
|
||||
// Default schema used by the models
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class FHC_Controller extends CI_Controller
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class FHC_Controller extends CI_Controller
|
||||
{
|
||||
const FHC_CONTROLLER_ID = 'fhc_controller_id'; // name of the parameter used to identify uniquely a call to a controller
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
|
||||
class FS_Model extends CI_Model
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class FS_Model extends CI_Model
|
||||
{
|
||||
protected $filepath; // Path of the file
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class JOB_Controller extends CLI_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads LogLib with different debug trace levels to get data of the job that extends this class
|
||||
// It also specify parameters to set database fields
|
||||
$this->load->library('LogLib', array(
|
||||
'classIndex' => 5,
|
||||
'functionIndex' => 5,
|
||||
'lineIndex' => 4,
|
||||
'dbLogType' => 'job', // required
|
||||
'dbExecuteUser' => 'Cronjob system'
|
||||
));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Protected methods
|
||||
|
||||
/**
|
||||
* Writes a cronjob info log
|
||||
*/
|
||||
protected function logInfo($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::INFO, 'Cronjob info', $response, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a cronjob debug log
|
||||
*/
|
||||
protected function logDebug($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::DEBUG, 'Cronjob debug', $response, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a cronjob warning log
|
||||
*/
|
||||
protected function logWarning($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::WARNING, 'Cronjob warning', $response, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a cronjob error log
|
||||
*/
|
||||
protected function logError($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::ERROR, 'Cronjob error', $response, $parameters);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Writes a log to database
|
||||
*/
|
||||
private function _log($level, $requestId, $response, $parameters)
|
||||
{
|
||||
$data = new stdClass();
|
||||
|
||||
$data->response = $response;
|
||||
if ($parameters != null) $data->parameters = $parameters;
|
||||
|
||||
switch($level)
|
||||
{
|
||||
case LogLib::INFO:
|
||||
$this->loglib->logInfoDB($requestId, json_encode(success($data, LogLib::INFO)));
|
||||
break;
|
||||
case LogLib::DEBUG:
|
||||
$this->loglib->logDebugDB($requestId, json_encode(success($data, LogLib::DEBUG)));
|
||||
break;
|
||||
case LogLib::WARNING:
|
||||
$this->loglib->logWarningDB($requestId, json_encode(error($data, LogLib::WARNING)));
|
||||
break;
|
||||
case LogLib::ERROR:
|
||||
$this->loglib->logErrorDB($requestId, json_encode(error($data, LogLib::ERROR)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user