Skip to content

Commit 27b9d63

Browse files
committed
feat: aggiunto badge informativo stato cron forzato per ambiente localhost
1 parent 5d6a9ee commit 27b9d63

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

modules/stato_servizi/src/CronStatusHook.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
namespace Modules\StatoServizi;
2222

23+
use App;
2324
use Carbon\Carbon;
2425
use Hooks\Manager;
2526
use Models\Cache;
@@ -72,6 +73,21 @@ public function response()
7273
}
7374
}
7475

76+
// Badge informativo per ambiente localhost
77+
$host = $_SERVER['HTTP_HOST'] ?? '';
78+
if (in_array($host, ['localhost', '127.0.0.1', '::1']) || str_starts_with($host, 'localhost:')) {
79+
$config = App::getConfig();
80+
$forza_cron = !empty($config['forza_cron_localhost']);
81+
82+
if ($forza_cron) {
83+
$badge = ' <span class="badge badge-success">'.tr('Cron forzato: ATTIVO').'</span>';
84+
} else {
85+
$badge = ' <span class="badge badge-warning">'.tr('Cron forzato: DISATTIVO').'</span>';
86+
}
87+
88+
$message .= $badge;
89+
}
90+
7591
// Ottiene il link al modulo aggiornamenti
7692
$aggiornamenti_module = Module::where('name', 'Aggiornamenti')->first();
7793
$link = $aggiornamenti_module ? base_path_osm().'/controller.php?id_module='.$aggiornamenti_module->id : base_path_osm().'/controller.php?id_module='.$this->getModuleId();

0 commit comments

Comments
 (0)