1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-18 12:30:35 +01:00
This commit is contained in:
loviuz 2020-11-25 13:14:29 +01:00
commit 9dd1769633
2 changed files with 10 additions and 15 deletions

View File

@ -18,6 +18,7 @@
*/ */
use Util\FileSystem; use Util\FileSystem;
use Models\Cache;
include_once __DIR__.'/../core.php'; include_once __DIR__.'/../core.php';
@ -574,10 +575,11 @@ if (!Auth::check() && (!empty($messages['info']) || !empty($messages['warning'])
} }
//Se la mia installazione supera una data dimensione visualizzo un messaggio //Se la mia installazione supera una data dimensione visualizzo un messaggio
$osm_size = $dbo->fetchOne('SELECT content FROM zz_cache WHERE name = "Spazio utilizzato"')['content']; $osm_size = Cache::pool('Spazio utilizzato')->content;
if (!empty(setting('Soft quota')) && !empty($osm_size)){ if (!empty(setting('Soft quota')) && !empty($osm_size)){
// Controllo sullo spazio disponibile // Controllo lo spazio disponibile
//$osm_size = disk_free_space('.'); //$osm_size = disk_free_space('.');
//$osm_size = FileSystem::folderSize(base_dir(), ['htaccess']); //$osm_size = FileSystem::folderSize(base_dir(), ['htaccess']);

View File

@ -21,7 +21,6 @@ namespace Modules\StatoServizi;
use Util\FileSystem; use Util\FileSystem;
use Hooks\CachedManager; use Hooks\CachedManager;
use Modules;
/** /**
@ -43,8 +42,7 @@ class SpaceHook extends CachedManager
public function response() public function response()
{ {
$osm_size = $this->getCache()->content; $osm_size = $this->getCache()->content;
$osm_size = FileSystem::folderSize(base_dir(), ['htaccess']);
$soft_quota = setting('Soft quota'); //MB $soft_quota = setting('Soft quota'); //MB
$space_limit = ($soft_quota / 100)*95; //MB $space_limit = ($soft_quota / 100)*95; //MB
@ -57,15 +55,14 @@ class SpaceHook extends CachedManager
return [ return [
'icon' => 'fa fa-database text-warning', 'icon' => 'fa fa-database text-warning',
'message' => $message, 'message' => $message,
'show' => ($osm_size > $space_limit), 'show' => ($osm_size > ($space_limit * 1048576)),
]; ];
} }
/** /**
* Controlla se è disponibile un aggiornamento nella repository GitHub. * Controlla se è disponibile un aggiornamento nella repository GitHub.
* *
* @return string|bool * @return int|bool
*/ */
public static function isAvailable() public static function isAvailable()
{ {
@ -73,13 +70,9 @@ class SpaceHook extends CachedManager
if (!empty(setting('Soft quota'))){ if (!empty(setting('Soft quota'))){
$osm_size = FileSystem::folderSize(base_dir(), ['htaccess']); $osm_size = FileSystem::folderSize(base_dir(), ['htaccess']);
$soft_quota = setting('Soft quota'); //MB return $osm_size;
$space_limit = ($soft_quota / 100)*95; //MB
if ($osm_size > ($space_limit * 1048576)) {
return $osm_size;
}
} }
return false; return false;