1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-01 16:36:45 +01:00

Fix minore

This commit is contained in:
Pek5892 2024-03-05 16:36:14 +01:00
parent 0ade18167a
commit f43d67e20d
9 changed files with 23 additions and 27 deletions

View File

@ -61,13 +61,13 @@ $handler->setFormatter($formatter);
$logger->pushHandler($handler);
// Lettura della cache
$ultima_esecuzione = Cache::pool('Ultima esecuzione del cron');
$ultima_esecuzione = Cache::pool(Cache::where('name','Ultima esecuzione del cron')->first()->id);
$data = $ultima_esecuzione->content;
$in_esecuzione = Cache::pool('Cron in esecuzione');
$cron_id = Cache::pool('ID del cron');
$in_esecuzione = Cache::pool(Cache::where('name','Cron in esecuzione')->first()->id);
$cron_id = Cache::pool(Cache::where('name','ID del cron')->first()->id);
$disattiva = Cache::pool('Disabilita cron');
$disattiva = Cache::pool(Cache::where('name','Disabilita cron')->first()->id);
if ($disattiva->content || (in_array($_SERVER['HTTP_HOST'], ['localhost', '127.0.0.1']) && !$forza_cron_localhost)) {
return;
}

View File

@ -39,8 +39,7 @@ switch (filter('op')) {
}
// Salvataggio della versione nella cache
Cache::pool('Ultima versione di OpenSTAManager disponibile')->set($versione);
Cache::pool(Cache::where('name','Ultima esecuzione del cron')->first()->id)->set($versione);
echo $versione;
break;

View File

@ -372,7 +372,7 @@ switch (filter('op')) {
break;
case 'informazioni-fe':
$info = Cache::pool('Informazioni su spazio FE');
$info = Cache::pool(Cache::where('name','Informazioni su spazio FE')->first()->id);
if (!$info->isValid()) {
$response = Services::request('POST', 'informazioni_fe');
$response = Services::responseBody($response);

View File

@ -42,7 +42,7 @@ class ReceiptHook extends Manager
}
// Lettura cache
$todo_cache = Cache::pool('Ricevute Elettroniche');
$todo_cache = Cache::pool(Cache::where('name','Ricevute Elettroniche')->first()->id);
return !$todo_cache->isValid() || !empty($todo_cache->content);
}
@ -50,8 +50,8 @@ class ReceiptHook extends Manager
public function execute()
{
// Lettura cache
$todo_cache = Cache::pool('Ricevute Elettroniche');
$completed_cache = Cache::pool('Ricevute Elettroniche importate');
$todo_cache = Cache::pool(Cache::where('name','Ricevute Elettroniche')->first()->id);
$completed_cache = Cache::pool(Cache::where('name','Ricevute Elettroniche importate')->first()->id);
// Refresh cache
if (!$todo_cache->isValid()) {
@ -95,8 +95,8 @@ class ReceiptHook extends Manager
public function response()
{
// Lettura cache
$todo_cache = Cache::pool('Ricevute Elettroniche');
$completed_cache = Cache::pool('Ricevute Elettroniche importate');
$todo_cache = Cache::pool(Cache::where('name','Ricevute Elettroniche')->first()->id);
$completed_cache = Cache::pool(Cache::where('name','Ricevute Elettroniche importate')->first()->id);
$completed_number = (is_array($completed_cache->content) ? count($completed_cache->content) : 0);
$total_number = $completed_number + (is_array($todo_cache->content) ? count($todo_cache->content) : 0);

View File

@ -44,22 +44,20 @@ class Task extends Resource implements RetrieveInterface, CreateInterface
$database = database();
// Rimozione della registrazione del cron attuale
$ultima_esecuzione = Cache::pool('Ultima esecuzione del cron');
$ultima_esecuzione->set(null);
Cache::pool(Cache::where('name','Ultima esecuzione del cron')->first()->id)->set(null);
// Segnalazione della chiusura al cron attuale
$cron_id = Cache::pool('ID del cron');
$cron_id->set(null);
Cache::pool(Cache::where('name','ID del cron')->first()->id)->set(null);
// Rimozione dell'eventuale blocco sul cron
$disattiva = Cache::pool('Disabilita cron');
$disattiva->set(null);
Cache::pool(Cache::where('name','Disabilita cron')->first()->id)->set(null);
// Salvataggio delle modifiche
$database->commitTransaction();
// Attesa della conclusione per il cron precedente
$in_esecuzione = Cache::pool('Cron in esecuzione');
$in_esecuzione = Cache::pool(Cache::where('name','Cron in esecuzione')->first()->id);
while ($in_esecuzione->content) {
$timestamp = (new Carbon())->addMinutes(1)->getTimestamp();
time_sleep_until($timestamp);

View File

@ -49,7 +49,7 @@ class Services
*/
public static function getInformazioni($force = false)
{
$cache = Cache::pool('Informazioni su Services');
$cache = Cache::pool(Cache::where('name','Informazioni su Services')->first()->id);
// Aggiornamento dei contenuti della cache
if (!$cache->isValid() || $force) {

View File

@ -30,7 +30,7 @@ abstract class CachedManager extends Manager
{
parent::__construct($hook);
$this->cache = Cache::pool($this->getCacheName());
$this->cache = Cache::pool(Cache::where('name', $this->getCacheName())->first()->id);
}
abstract public function cacheData();

View File

@ -82,7 +82,7 @@ class Modules
{
self::getModules();
return Module::pool($module);
return Module::find($module);
}
/**

View File

@ -19,7 +19,7 @@
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
use Models\Cache;
/**
* Classe dedicata alla gestione delle procedure di aggiornamento del database del progetto.
*
@ -208,8 +208,7 @@ class Update
self::normalizeDatabase($database->getDatabaseName());
if (class_exists('\Models\Cache')) {
Models\Cache::pool('Ultima versione di OpenSTAManager disponibile')->set(null);
}
Cache::pool(Cache::where('name','Ultima versione di OpenSTAManager disponibile')->first()->id)->set(null); }
// Correzione permessi per le cartelle backup e files
$fs = new SymfonyFilesystem();