mirror of
https://github.com/Karaka-Management/oms-Monitoring.git
synced 2026-02-15 16:58:41 +00:00
make id public, organigram impl. media password/encryption, settings bug fix, Money->FloatInt change, ...
This commit is contained in:
parent
cfc5de9d4f
commit
2398a78105
35
Admin/Install/Workflow.install.json
Executable file
35
Admin/Install/Workflow.install.json
Executable file
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"triggers": [
|
||||||
|
],
|
||||||
|
"actions": {
|
||||||
|
"1000700001": {
|
||||||
|
"name": "Error report",
|
||||||
|
"description": {
|
||||||
|
"en": "Send error report",
|
||||||
|
"de": "Versende Fehlerbericht"
|
||||||
|
},
|
||||||
|
"function_type": "Cli",
|
||||||
|
"function": "cliLogReport",
|
||||||
|
"module": "Monitoring",
|
||||||
|
"inputs": [
|
||||||
|
"email",
|
||||||
|
"{*}"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
"resources[]",
|
||||||
|
"{*}"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"email": {
|
||||||
|
"type": "input",
|
||||||
|
"subtype": "text",
|
||||||
|
"default": null,
|
||||||
|
"title": {
|
||||||
|
"en": "Email",
|
||||||
|
"de": "Email"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
43
Admin/Install/Workflow.php
Executable file
43
Admin/Install/Workflow.php
Executable file
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Karaka
|
||||||
|
*
|
||||||
|
* PHP Version 8.1
|
||||||
|
*
|
||||||
|
* @package Modules\Monitoring\Admin\Install
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Monitoring\Admin\Install;
|
||||||
|
|
||||||
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Workflow class.
|
||||||
|
*
|
||||||
|
* @package Modules\Monitoring\Admin\Install
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class Workflow
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Install workflow providing
|
||||||
|
*
|
||||||
|
* @param ApplicationAbstract $app Application
|
||||||
|
* @param string $path Module path
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public static function install(ApplicationAbstract $app, string $path) : void
|
||||||
|
{
|
||||||
|
\Modules\Workflow\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Workflow.install.json']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -47,45 +47,34 @@ final class CliController extends Controller
|
||||||
*/
|
*/
|
||||||
public function cliLogReport(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
|
public function cliLogReport(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
|
||||||
{
|
{
|
||||||
//return new NullView();
|
$handler = $this->app->moduleManager->get('Admin', 'Api')->setUpServerMailHandler();
|
||||||
|
|
||||||
/** @var \Model\Setting[] $emailSettings */
|
|
||||||
$emailSettings = $this->app->appSettings->get(
|
$emailSettings = $this->app->appSettings->get(
|
||||||
names: [
|
names: SettingsEnum::MAIL_SERVER_ADDR,
|
||||||
SettingsEnum::MAIL_SERVER_ADDR,
|
module: 'OnlineResourceWatcher'
|
||||||
SettingsEnum::MAIL_SERVER_CERT,
|
|
||||||
SettingsEnum::MAIL_SERVER_KEY,
|
|
||||||
SettingsEnum::MAIL_SERVER_KEYPASS,
|
|
||||||
SettingsEnum::MAIL_SERVER_TLS,
|
|
||||||
],
|
|
||||||
module: 'Admin'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var \Modules\Admin\Models\Account $account */
|
$today = new \DateTime('now');
|
||||||
$account = AccountMapper::get()->where('id', 1)->execute();
|
|
||||||
|
|
||||||
/** @var \phpOMS\Message\Mail\MailHandler $mailHandler */
|
$hasErrorReport = \is_file($file = __DIR__ . '/../../../Logs/' . $today->format('Y-m-d') . '.log');
|
||||||
$mailHandler = $this->app->moduleManager->get('Admin', 'Api')->setUpServerMailHandler();
|
|
||||||
|
|
||||||
|
// @todo: define report email template
|
||||||
$mail = new Email();
|
$mail = new Email();
|
||||||
$mail->setFrom($emailSettings[SettingsEnum::MAIL_SERVER_ADDR]->content, 'Karaka');
|
$mail->setFrom($emailSettings->content);
|
||||||
$mail->addTo($emailSettings[SettingsEnum::MAIL_SERVER_ADDR]->content, \trim($account->name1 . ' ' . $account->name2 . ' ' . $account->name3));
|
$mail->addTo($emailSettings->content);
|
||||||
$mail->subject = 'Log report';
|
$mail->subject = 'Error report';
|
||||||
$mail->body = '';
|
|
||||||
$mail->msgHTML('Attached please find the daily log report');
|
|
||||||
$mail->addAttachment(__DIR__ . '/../../../humans.txt');
|
|
||||||
|
|
||||||
if (!empty($emailSettings[SettingsEnum::MAIL_SERVER_CERT]->content ?? '')
|
if ($hasErrorReport) {
|
||||||
&& !empty($emailSettings[SettingsEnum::MAIL_SERVER_KEY]->content ?? '')
|
$mail->body = 'Your daily Error report.';
|
||||||
) {
|
$mail->bodyAlt = 'Your daily Error report.';
|
||||||
$mail->sign(
|
|
||||||
$emailSettings[SettingsEnum::MAIL_SERVER_CERT]->content,
|
$mail->addAttachment($file);
|
||||||
$emailSettings[SettingsEnum::MAIL_SERVER_KEY]->content,
|
} else {
|
||||||
$emailSettings[SettingsEnum::MAIL_SERVER_KEYPASS]->content
|
$mail->body = 'No errors today.';
|
||||||
);
|
$mail->bodyAlt = 'No errors today.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$mailHandler->send($mail);
|
$handler->send($mail);
|
||||||
|
|
||||||
return new NullView();
|
return new NullView();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user