fix panel headers in css, add cron job monitor to check if cron is running, has run, or not setup
This commit is contained in:
parent
13aabeea8e
commit
723e99ebed
@ -214,6 +214,12 @@ if ($config['router_check']) {
|
||||
$ui->assign('routeroffs', $routeroffs);
|
||||
}
|
||||
|
||||
$timestampFile = "$UPLOAD_PATH/cron_last_run.txt";
|
||||
if (file_exists($timestampFile)) {
|
||||
$lastRunTime = file_get_contents($timestampFile);
|
||||
$ui->assign('run_date', date('Y-m-d h:i:s A', $lastRunTime));
|
||||
}
|
||||
|
||||
// Assign the monthly sales data to Smarty
|
||||
$ui->assign('start_date', $start_date);
|
||||
$ui->assign('current_date', $current_date);
|
||||
|
@ -1,6 +1,27 @@
|
||||
<?php
|
||||
|
||||
include "../init.php";
|
||||
$lockFile = "$CACHE_PATH/router_monitor.lock";
|
||||
|
||||
if (!is_dir($CACHE_PATH)) {
|
||||
echo "Directory '$CACHE_PATH' does not exist. Exiting...\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$lock = fopen($lockFile, 'c');
|
||||
|
||||
if ($lock === false) {
|
||||
echo "Failed to open lock file. Exiting...\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!flock($lock, LOCK_EX | LOCK_NB)) {
|
||||
echo "Script is already running. Exiting...\n";
|
||||
fclose($lock);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$isCli = true;
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
$isCli = false;
|
||||
@ -81,27 +102,7 @@ foreach ($d as $ds) {
|
||||
|
||||
|
||||
if ($config['router_check']) {
|
||||
|
||||
$lockFile = $CACHE_PATH . '/router_monitor.lock';
|
||||
|
||||
if (!is_dir($CACHE_PATH)) {
|
||||
echo "Directory '$CACHE_PATH' does not exist. Exiting...\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$lock = fopen($lockFile, 'c');
|
||||
|
||||
if ($lock === false) {
|
||||
echo "Failed to open lock file. Exiting...\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!flock($lock, LOCK_EX | LOCK_NB)) {
|
||||
echo "Script is already running. Exiting...\n";
|
||||
fclose($lock);
|
||||
exit;
|
||||
}
|
||||
|
||||
echo "Checking router status...\n";
|
||||
$routers = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
|
||||
if (!$routers) {
|
||||
echo "No active routers found in the database.\n";
|
||||
@ -186,14 +187,20 @@ if ($config['router_check']) {
|
||||
Message::SendEmail($adminEmail, $subject, $message);
|
||||
sendTelegram($message);
|
||||
}
|
||||
|
||||
if (defined('PHP_SAPI') && PHP_SAPI === 'cli') {
|
||||
echo "Cronjob finished\n";
|
||||
} else {
|
||||
echo "</pre>";
|
||||
}
|
||||
|
||||
flock($lock, LOCK_UN);
|
||||
fclose($lock);
|
||||
unlink($lockFile);
|
||||
echo "Router monitoring finished\n";
|
||||
}
|
||||
|
||||
|
||||
if (defined('PHP_SAPI') && PHP_SAPI === 'cli') {
|
||||
echo "Cronjob finished\n";
|
||||
} else {
|
||||
echo "</pre>";
|
||||
}
|
||||
|
||||
flock($lock, LOCK_UN);
|
||||
fclose($lock);
|
||||
unlink($lockFile);
|
||||
|
||||
$timestampFile = "$UPLOAD_PATH/cron_last_run.txt";
|
||||
file_put_contents($timestampFile, time());
|
||||
|
||||
|
@ -194,6 +194,23 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $run_date}
|
||||
{if $current_time - $run_time > 3600}
|
||||
<div class="panel panel-warning panel-hovered mb20 activities">
|
||||
<div class="panel-heading"><i class="fa fa-clock-o"></i> {Lang::T('Cron has not run for over 1 hour. Please
|
||||
check your setup.')}</div>
|
||||
</div>
|
||||
{else}
|
||||
<div class="panel panel-success panel-hovered mb20 activities">
|
||||
<div class="panel-heading">{Lang::T('Cron Job last ran on')}: {$run_date}</div>
|
||||
</div>
|
||||
{/if}
|
||||
{else}
|
||||
<div class="panel panel-danger panel-hovered mb20 activities">
|
||||
<div class="panel-heading"><i class="fa fa-warning"></i> {Lang::T('Cron appear not been setup, please check
|
||||
your cron setup.')}</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $_c['hide_pg'] != 'yes'}
|
||||
<div class="panel panel-success panel-hovered mb20 activities">
|
||||
<div class="panel-heading">{Lang::T('Payment Gateway')}: {str_replace(',',', ',$_c['payment_gateway'])}
|
||||
|
@ -148,12 +148,26 @@
|
||||
color: inherit;
|
||||
background-color: transparent;
|
||||
border-color: transparent;
|
||||
border-bottom-right-radius: 21px;
|
||||
border-bottom-left-radius: 21px;
|
||||
}
|
||||
|
||||
.panel-primary>.panel-heading {
|
||||
color: inherit;
|
||||
background-color: transparent;
|
||||
border-color: transparent;
|
||||
.panel-success>.panel-heading {
|
||||
border-bottom-right-radius: 21px;
|
||||
border-bottom-left-radius: 21px;
|
||||
}
|
||||
|
||||
.panel-warning>.panel-heading {
|
||||
border-bottom-right-radius: 21px;
|
||||
border-bottom-left-radius: 21px;
|
||||
}
|
||||
|
||||
.panel-danger>.panel-heading {
|
||||
color: #a94442;
|
||||
background-color: #f2dede;
|
||||
border-color: #ebccd1;
|
||||
border-bottom-right-radius: 21px;
|
||||
border-bottom-left-radius: 21px;
|
||||
}
|
||||
|
||||
.panel-heading {
|
||||
@ -656,6 +670,9 @@
|
||||
}
|
||||
|
||||
.toggle-container {
|
||||
position: absolute;
|
||||
top: 17px;
|
||||
right: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@ -666,6 +683,11 @@
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.toggle-container {
|
||||
top: 15px;
|
||||
right: 60px;
|
||||
}
|
||||
|
||||
.toggle-container .toggle-icon {
|
||||
font-size: 20px;
|
||||
color: rgb(100 116 139);
|
||||
|
Loading…
x
Reference in New Issue
Block a user