= 1073741824) return number_format($bytes / 1073741824, 2) . ' GB'; if ($bytes >= 1048576) return number_format($bytes / 1048576, 1) . ' MB'; if ($bytes >= 1024) return number_format($bytes / 1024, 1) . ' KB'; return $bytes . ' B'; } // --- PHP --------------------------------------------------------------- $phpChecks = array( array('PHP version', PHP_VERSION_ID >= 80100, PHP_VERSION), ); foreach (array('mysqli' => true, 'curl' => false, 'openssl' => false, 'gd' => false, 'zip' => false, 'mbstring' => false) as $ext => $required) { $phpChecks[] = array( 'Extension: ' . $ext, extension_loaded($ext), extension_loaded($ext) ? 'Loaded' : ($required ? 'Missing (required)' : 'Missing (optional)'), ); } // --- Database ------------------------------------------------------------ $dbSize = db()->fetchOne(" SELECT ROUND(SUM(data_length + index_length)) AS `bytes`, COUNT(*) AS `tables` FROM `information_schema`.`tables` WHERE `table_schema` = DATABASE(); "); $dbBytes = (int)($dbSize['bytes'] ?? 0); $dbTables = (int)($dbSize['tables'] ?? 0); // --- Cache ----------------------------------------------------------- $cacheStats = function_exists('znote_cache_stats') ? znote_cache_stats() : array('files' => 0, 'bytes' => 0, 'apcu_available' => false); // --- Migrations -------------------------------------------------------- $migrationStatus = function_exists('znote_migrations_status') ? znote_migrations_status() : array(); $pendingMigrations = 0; foreach ($migrationStatus as $m) { if (($m['state'] ?? '') === 'pending') $pendingMigrations++; } // --- Disk -------------------------------------------------------------- $diskFree = @disk_free_space(dirname(__DIR__, 2)); $diskTotal = @disk_total_space(dirname(__DIR__, 2)); // --- Error log ----------------------------------------------------------- $errorLogPath = trim((string)(setting('error_log:path', '') ?: (string)@ini_get('error_log'))); $errorLogSize = ($errorLogPath !== '' && is_file($errorLogPath)) ? (int)filesize($errorLogPath) : null; $errorLogModified = ($errorLogPath !== '' && is_file($errorLogPath)) ? (int)filemtime($errorLogPath) : null; // --- Backups ------------------------------------------------------------- $backups = function_exists('znote_backups_list') ? znote_backups_list() : array(); $lastBackup = $backups[0] ?? null; ?>
0 ? 'amber' : 'green'); acp_stat(t_default('acp.health.stat_backup', 'Last backup'), $lastBackup ? h(getClock((int)$lastBackup['time'], true)) : t_default('acp.health.no_backup', 'None yet'), 'fa-archive', acp_url('backups'), $lastBackup ? 'green' : 'amber'); ?>

0): ?>
/

'' . h($errorLogPath) . '', 'size' => h(acp_health_bytes($errorLogSize)), 'when' => h(getClock((int)$errorLogModified, true)), ]) ?>