Page statistiques

This commit is contained in:
leosw
2025-08-30 11:24:04 +02:00
parent 10a72dcdb9
commit 06bf74ea21
3 changed files with 40 additions and 0 deletions

View File

@@ -120,6 +120,19 @@ if(isset($controller->splitted_url[1]) && $user->rankIsHigher("moderator")) {
$notfound = 1;
}
break;
case 'stats':
if ($user->rankIsHigher("moderator")) {
$head['title'] = "Statistiques";
$report = $config['abs_root_folder'];
$command = '(zcat /var/log/nginx/kabano.org-access.log*.gz && cat /var/log/nginx/kabano.org-access.log.1) | goaccess --log-format=COMBINED -o '.escapeshellarg($report);
exec($command, $output, $result);
include ($config['views_folder']."d.admin.stats.html");
}
else {
$notfound = 1;
}
break;
default:
$notfound = 1;
break;

View File

@@ -16,6 +16,7 @@
<? if($user->rankIsHigher("moderator")) { ?>
<a href="<?=$config['rel_root_folder']?>admin/logs" class="button"><i class="fas fa-history"></i> Voir les logs</a> <small>Permet d'accéder aux 200 dernières lignes des logs bruts des actions sur la base de données.</small><br><br>
<a href="<?=$config['rel_root_folder']?>admin/wiki-files" class="button"><i class="fas fa-paperclip"></i> Fichiers attachés</a><small>Gérer les fichiers attachés pour le wiki : liste, ajout, suppression...</small><br><br>
<a href="<?=$config['rel_root_folder']?>admin/stats" class="button"><i class="fas fa-chart-line"></i> Statistiques</a><small>Analyser les logs et afficher les statistiques.</small><br><br>
<? } ?>
</section>

26
views/d.admin.stats.html Normal file
View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="fr">
<? include('blocks/d.head.html'); ?>
<body>
<? include('blocks/d.nav.html'); ?>
<section>
<h1><?=$head['title']?></h1>
<br>
<br><h3>Retour de l'execution de la commande :</h3><br>
<pre><?
foreach($output as $line) {
echo $line."<br>";
}
?></pre>
<br>
<br><a href='/report.html' target='_blank'><i class="fas fa-chart-line"></i> Voir le rapport</a>
</section>
<? include('blocks/d.footer.html'); ?>
</body>
</html>