some UI adjustments

This commit is contained in:
HB9HIL
2024-08-21 17:16:10 +02:00
parent f76db5c58e
commit 7e0648df75
2 changed files with 14 additions and 11 deletions

View File

@@ -37,6 +37,7 @@ class cron extends CI_Controller {
$data['page_title'] = __("Cron Manager");
$data['crons'] = $this->cron_model->get_crons();
$data['cron_allow_insecure'] = $this->config->item('cron_allow_insecure');
$mastercron = array();
$mastercron = $this->get_mastercron_status();
@@ -257,19 +258,19 @@ class cron extends CI_Controller {
$diff = $now->getTimestamp() - $timestamp_last_run->getTimestamp();
if ($diff >= 0 && $diff <= $warning_timelimit_seconds) {
$result['status'] = 'OK';
$result['status'] = __("OK");
$result['status_class'] = 'success';
} else {
if ($diff <= $error_timelimit_seconds) {
$result['status'] = 'Last run occurred more than ' . $warning_timelimit_seconds . ' seconds ago.<br>Please check your master cron! It should run every minute (* * * * *).';
$result['status'] = sprintf(__("Last run occurred more than %s seconds ago.<br>Please check your master cron! It should run every minute (* * * * *)."), $warning_timelimit_seconds);
$result['status_class'] = 'warning';
} else {
$result['status'] = 'Last run occurred more than ' . ($error_timelimit_seconds / 60) . ' minutes ago.<br>Seems like your Mastercron isn\'t running!<br>It should run every minute (* * * * *).';
$result['status'] = sprintf(__("Last run occurred more than %s minutes ago.<br>Seems like your Mastercron isn't running!<br>It should run every minute (* * * * *)."), ($error_timelimit_seconds / 60));
$result['status_class'] = 'danger';
}
}
} else {
$result['status'] = 'Not running';
$result['status'] = _pgettext("Master Cron", "Not running");
$result['status_class'] = 'danger';
}

View File

@@ -14,17 +14,19 @@
<p class="card-text">
<?= __("The Cron Manager assists the administrator in managing cron jobs without requiring CLI access."); ?>
</p>
<p class="card-text">
<?= __("To execute cron jobs based on the data below, remove all old cron jobs and create a new one:"); ?>
</p>
<div class="main_cronjob">
<pre><code id="main_cronjob">* * * * * curl --silent <?php echo base_url(); ?>index.php/cron/run &>/dev/null</code><span data-bs-toggle="tooltip" title="<?= __("Copy to clipboard"); ?>" onclick='copyCron("main_cronjob")'><i class="copy-icon fas fa-copy"></i></span></pre>
</div>
<?php if ($mastercron['status_class'] != 'success') { ?>
<p class="card-text">
<?= __("To execute cron jobs based on the data below, remove all old cron jobs and create a new one:"); ?>
</p>
<div class="main_cronjob">
<pre><code id="main_cronjob">* * * * * curl --silent <?php if ($cron_allow_insecure) { echo '--insecure '; } echo base_url(); ?>index.php/cron/run &>/dev/null</code><span data-bs-toggle="tooltip" title="<?= __("Copy to clipboard"); ?>" onclick='copyCron("main_cronjob")'><i class="copy-icon fas fa-copy"></i></span></pre>
</div>
<?php } ?>
</div>
<div class="col text-end" id="alert_status">
<?php if (version_compare(PHP_VERSION, $min_php_version) >= 0) { ?>
<div class="alert alert-<?php echo $mastercron['status_class'] ?? 'danger'; ?> d-inline-block">
<?= __("Status Master-Cron"); ?>: <?php echo $mastercron['status'] ?? 'Not running'; ?>
<?= __("Status Master-Cron"); ?>: <?php echo $mastercron['status'] ?? _pgettext("Master Cron", "Not running"); ?>
</div>
<?php } else { ?>
<div class="alert alert-danger d-inline-block">