Skip to content

Commit ccf3c4d

Browse files
committed
fix: lettura cache Informazioni su services
1 parent 8c14a9f commit ccf3c4d

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

modules/stato_servizi/src/ServicesHookTask.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ public function execute()
3535
$result = [
3636
'response' => 1,
3737
'message' => tr('Controllo servizi attivi completato!'),
38-
];
39-
38+
];
39+
40+
$cache = Cache::where('name', 'Informazioni su Services')->first();
41+
4042
try {
4143
if (Services::isEnabled()) {
42-
$servizi = Services::getServiziAttivi();
43-
$cache = Cache::where('name', 'Informazioni su Services')->first();
44-
$cache->set($servizi);
44+
$result = Services::getServiziAttivi();
4545
}
4646
} catch (\Exception $e) {
4747
$result = [
@@ -50,9 +50,9 @@ public function execute()
5050
'_error_' => $e->getMessage(),
5151
]),
5252
];
53-
$cache->set($result);
54-
}
53+
}
5554

55+
$cache->set($result);
5656
return $result;
5757
}
5858
}

src/API/Services.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static function getInformazioni($force = false)
5656
$cache = Cache::where('name', 'Informazioni su Services')->first();
5757

5858
// Aggiornamento dei contenuti della cache
59-
if (!$cache->isValid() || $force) {
59+
if (!$cache->isValid() || $force || empty($cache->content)) {
6060
// Calcolo spazio occupato
6161
$spazio_occupato = self::calcolaSpazioOccupato();
6262

0 commit comments

Comments
 (0)