<?php
namespace Modules\Admin\CronJobs\Runner; class Controller extends \App\Mvc\Controller\CLIAbstract { protected function initialize() { parent::initialize(); $this->actionsCfg['run'] = []; } public function actionRun($R) { if (SHOW_DEBUGS && ($R['executionType'] == 'develop-browser')) { echo <<<HTML
				<head>
					<style>
						body {
							background-color: #f8f8f8;
							color: #444444;
						}
						div[class^="type-"] {
						    display: flex;
    						flex-direction: row;
						}
						.type {
							order: -1;
							min-width: 50px;
							padding-right: 0.25em;
						}
						.time {
							order: -3;
						}
						.memory {
							order: -2;
							min-width: 3em;
							text-align: right;
							color: #666;
							padding-right: 0.25em;
						}
						.type-critical .type     { color: #dc3545; }
						.type-error .type        { color: #dc3545; }
						.type-info .type         { color: #888888; }
						.type-idle .type         { color: #17a2b8; }
						.type-warning .type      { color: #ffc107; }
						.type-success .type      { color: #28a745; }

						.type,
						.time {
							padding: 0 15px 0 0;
							font-weight: bold;
						}
						div {
							font-family: monospace;
							font-size: 12px;
							width: 100%;
							line-height:150%;
						}
					</style>
				</head>
				<body>
					<div>
HTML;
session_write_close(); $_SESSION = null; set_time_limit(60*60*12); } $cron = \App\Cron\Main::getCronjobObj($R['job']); $cron->setExecutionType($R['executionType']); $cronJobLogs = new \App\Cron\Log(); $cronUpdate = \Entity\CronJob::update($cron->getId()); $cronUpdate->isQueued = 0; $cronUpdate->save(); $trailItem = \App\UserTrailItem::create($this->getModule(), 'actionRun'); \App\UserTrail::getInstance()->addItem($trailItem); $cron->execute(); if ($R['logId']) { $logger = $cron->getLogger(); $errorStatus = []; if ($logger->has('critical')) { $errorStatus[]= 'c'; } if ($logger->has('error')) { $errorStatus[]= 'e'; } if ($logger->has('warning')) { $errorStatus[]= 'w'; } if ($logger->has('info')) { $errorStatus[]= 'i'; } if ($logger->has('idle')) { $errorStatus[]= 'd'; } if ($logger->has('waiting')) { $errorStatus[]= 'g'; } if ($logger->has('success')) { $errorStatus[]= 's'; } $cronJobLogs->update($R['logId'], [ 'status' => 'ended', 'errorStatus' => implode('', $errorStatus), ]); } if (SHOW_DEBUGS && ($R['executionType'] == 'develop-browser')){ echo <<<HTML
				</div>
			</body>
HTML;
} return new \Engine\Mvc\Response\None(); } }