beta of cache debug view

This commit is contained in:
HB9HIL
2026-02-02 13:37:06 +01:00
parent 9fa0604810
commit 02eccc6f1a
3 changed files with 41 additions and 15 deletions

View File

@@ -106,8 +106,17 @@ class Debug extends CI_Controller
}
// Cache Info
$data['cache_info'] = $this->debug_model->get_cache_info();
$cache_info = $this->debug_model->get_cache_info();
$data['cache_available_adapters'] = $cache_info['adapters'];
$data['cache_path'] = $cache_info['config']['cache_path'] ?: 'application/cache';
$data['cache_adapter'] = ucfirst($cache_info['config']['cache_adapter'] ?? 'file');
$data['cache_backup'] = ucfirst($cache_info['config']['cache_backup'] ?? 'file');
$data['cache_key_prefix'] = $cache_info['config']['cache_key_prefix'] ?: __("(empty)");
$data['active_adapter'] = ucfirst($cache_info['active']['adapter'] ?? ($cache_info['config']['cache_adapter'] ?? 'file'));
$data['using_backup'] = !empty($cache_info['active']['using_backup']);
$data['details_cache_size'] = $cache_info['details']['size'] ?? '0 B';
$data['details_cache_keys_count'] = $cache_info['details']['keys_count'] ?? 0;
$data['dxcc_update'] = $this->cron_model->cron('update_dxcc')->row();
$data['dok_update'] = $this->cron_model->cron('update_update_dok')->row();
$data['lotw_user_update'] = $this->cron_model->cron('update_lotw_users')->row();

View File

@@ -229,6 +229,10 @@ class Debug_model extends CI_Model
'key_prefix' => $cache_key_prefix
]);
$active_adapter = method_exists($this->cache, 'get_loaded_driver') ? $this->cache->get_loaded_driver() : $cache_adapter;
$response['active']['adapter'] = $active_adapter;
$response['active']['using_backup'] = ($active_adapter !== $cache_adapter);
// Get cache details
$cache_size = $this->get_cache_size();
$cache_keys_count = $this->get_cache_keys_count();

View File

@@ -408,40 +408,53 @@
<p><u><?= __("Current Configuration"); ?></u></p>
<table width="100%" class="table table-sm table-striped">
<tr>
<td><strong><?= __("Adapter"); ?></strong></td>
<td><strong><?= _pgettext("Cache Adapter","Primary adapter"); ?></strong></td>
<td>
<span class="badge text-bg-info"><?php echo ucfirst($cache_info['config']['cache_adapter'] ?? 'file'); ?></span>
<span class="badge text-bg-primary"><?php echo $cache_adapter; ?></span>
<?php if ($cache_adapter == $active_adapter) { ?>
<span class="badge text-bg-success float-end"><?= __("Active"); ?></span>
<?php } else { ?>
<span class="badge text-bg-danger float-end"><?= __("Failed"); ?></span>
<?php } ?>
</td>
</tr>
<tr>
<td><strong><?= __("Backup"); ?></strong></td>
<td><strong><?= _pgettext("Cache Backup Adapter (Fallback)","Backup adapter"); ?></strong></td>
<td>
<span class="badge text-bg-secondary"><?php echo ucfirst($cache_info['config']['cache_backup'] ?? 'file'); ?></span>
<span class="badge text-bg-primary"><?php echo $cache_backup; ?></span>
<?php if ($cache_backup == $active_adapter) { ?>
<span class="badge text-bg-success float-end"><?= __("Active"); ?></span>
<?php } ?>
</td>
</tr>
<tr>
<td><strong><?= __("Path"); ?></strong></td>
<td><code><?php echo $cache_info['config']['cache_path'] ?: 'application/cache'; ?></code></td>
<td><strong><?= _pgettext("Cache Path","Path for files adapter"); ?></strong></td>
<td><code><?php echo $cache_path; ?></code></td>
</tr>
<tr>
<td><strong><?= __("Key Prefix"); ?></strong></td>
<td><code><?php echo $cache_info['config']['cache_key_prefix'] ?: __("(empty)"); ?></code></td>
<td><strong><?= _pgettext("Cache Key Prefix","Key Prefix"); ?></strong></td>
<td><code><?php echo $cache_key_prefix; ?></code></td>
</tr>
</table>
<?php if ($using_backup) { ?>
<div class="alert alert-danger mt-2 mb-0" role="alert">
<?= __("Cache is currently using the backup adapter because the primary is unavailable."); ?>
</div>
<?php } ?>
</div>
<div class="col-md-6">
<p><u><?= __("Cache Details"); ?></u></p>
<table width="100%" class="table table-sm table-striped">
<tr>
<td><strong><?= __("Total Size"); ?></strong></td>
<td><strong><?= _pgettext("Cache Details","Total Size"); ?></strong></td>
<td>
<span class="badge text-bg-primary"><?php echo $cache_info['details']['size'] ?? '0 B'; ?></span>
<span class="badge text-bg-primary"><?php echo $details_cache_size; ?></span>
</td>
</tr>
<tr>
<td><strong><?= __("Number of Keys"); ?></strong></td>
<td><strong><?= _pgettext("Cache Key","Number of Keys"); ?></strong></td>
<td>
<span class="badge text-bg-primary"><?php echo $cache_info['details']['keys_count'] ?? '0'; ?></span>
<span class="badge text-bg-primary"><?php echo $details_cache_keys_count; ?></span>
</td>
</tr>
</table>
@@ -455,7 +468,7 @@
<div class="border-top pt-3 mt-3">
<p><u><?= __("Available Adapters"); ?></u></p>
<div>
<?php foreach ($cache_info['adapters'] as $adapter => $supported) { ?>
<?php foreach ($cache_available_adapters as $adapter => $supported) { ?>
<?php if ($supported) { ?>
<span class="badge text-bg-success"><?php echo ucfirst($adapter); ?></span>
<?php } else { ?>