mirror of
https://github.com/Karaka-Management/oms-Monitoring.git
synced 2026-01-11 16:38:40 +00:00
102 lines
1.8 KiB
PHP
Executable File
102 lines
1.8 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Jingga
|
|
*
|
|
* PHP Version 8.2
|
|
*
|
|
* @package Modules\Monitoring
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 2.0
|
|
* @version 1.0.0
|
|
* @link https://jingga.app
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Monitoring\Controller;
|
|
|
|
use Modules\Monitoring\Models\ImpressionStat;
|
|
use Modules\Monitoring\Models\ImpressionStatMapper;
|
|
use phpOMS\Message\Http\HttpRequest;
|
|
use phpOMS\Module\ModuleAbstract;
|
|
|
|
/**
|
|
* Monitoring controller class.
|
|
*
|
|
* @package Modules\Monitoring
|
|
* @license OMS License 2.0
|
|
* @link https://jingga.app
|
|
* @since 1.0.0
|
|
*/
|
|
class Controller extends ModuleAbstract
|
|
{
|
|
/**
|
|
* Module path.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
public const PATH = __DIR__ . '/../';
|
|
|
|
/**
|
|
* Module version.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
public const VERSION = '1.0.0';
|
|
|
|
/**
|
|
* Module name.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
public const NAME = 'Monitoring';
|
|
|
|
/**
|
|
* Module id.
|
|
*
|
|
* @var int
|
|
* @since 1.0.0
|
|
*/
|
|
public const ID = 1000700000;
|
|
|
|
/**
|
|
* Providing.
|
|
*
|
|
* @var string[]
|
|
* @since 1.0.0
|
|
*/
|
|
public static array $providing = [];
|
|
|
|
/**
|
|
* Dependencies.
|
|
*
|
|
* @var string[]
|
|
* @since 1.0.0
|
|
*/
|
|
public static array $dependencies = [];
|
|
|
|
/**
|
|
* Create an impression log
|
|
*
|
|
* @param HttpRequest $request Request object
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function helperLogRequestStat(HttpRequest $request) : void
|
|
{
|
|
if (!$this->active) {
|
|
return;
|
|
}
|
|
|
|
$stat = new ImpressionStat($request);
|
|
$stat->end = new \DateTime('now');
|
|
|
|
// This is not run through the createModel() function on purpose
|
|
ImpressionStatMapper::create()->execute($stat);
|
|
}
|
|
}
|