summaryrefslogtreecommitdiff
path: root/pages/debug.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/debug.php')
-rw-r--r--pages/debug.php96
1 files changed, 0 insertions, 96 deletions
diff --git a/pages/debug.php b/pages/debug.php
deleted file mode 100644
index fdd6fec..0000000
--- a/pages/debug.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn;
-require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
-
-function itemToName(string $item): string {
- if ($item === "docs_cleanup") return "Deleting scheduled documents";
- if ($item === "important_backup") return "Differential backups";
- if ($item === "restore") return "Failure protection";
- if ($item === "backups") return "Encrypted off-site backups";
- if ($item === "calendar") return "Google Calendar integration";
-
- if (str_starts_with($item, "system-")) {
- $system = explode("-", $item)[2];
- $type = explode("-", $item)[1];
- $systemName = $system === "gdapd" ? "Raindrops System" : "Cloudburst System";
-
- return match ($type) {
- "general" => "General info about $systemName",
- "members" => "Members in the $systemName",
- "fronters" => "Current fronter(s) in the $systemName",
- "switches" => "Switch history from the $systemName",
- default => "$type in $systemName",
- };
- }
-
- if (str_starts_with($item, "images-")) {
- $system = explode("-", $item)[1];
- $id = explode("-", $item)[2];
- $systemName = $system === "gdapd" ? "Raindrops" : "Cloudburst";
- $member = getSystemMember($system, $id) ?? [ "name" => $id, "display_name" => $id, "id" => $id ];
-
- if ($member["name"] === "unknown") {
- return "Unknown (" . $systemName . ")'s images";
- } else {
- return getMiniName($member["display_name"] ?? $member["name"]) . "'s images";
- }
- }
-
- return "<code>$item</code>";
-}
-
-?>
-
-<br>
-<div class="container">
- <?php $data = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/refresh.json"), true); ?>
-
- <div id="page-content">
- <h2>Data updater debugging</h2>
- <p>This page provides debugging information to troubleshoot unexpectedly long update times or reported failures.</p>
-
- <h4>General information</h4>
- <ul>
- <li><b>Update date:</b> <?php $dt = DateTime::createFromFormat('U.u', $data["timestamp"]); echo($dt->format("l j F Y, G:i:s.u T")); ?></li>
- <li><b>Total duration:</b> <?= round($data["duration"] * 1000) ?> ms</li>
- <li><b>Longest operation:</b> <?= itemToName(array_search(max(array_values($data["times"])), $data["times"])) ?? "-" ?> (<?= round(max(array_values($data["times"])) * 1000) ?> ms, <?= round((max(array_values($data["times"])) / $data["duration"]) * 100, 2) ?>%)</li>
- </ul>
-
- <h4>Processing times</h4>
- <div>
- <?php foreach ($data["times"] as $item => $time): ?><span class="element tooltip-nohelp" title="<b><?= itemToName($item) ?></b><br>(<?= round($time * 1000) ?> ms)" data-bs-toggle="tooltip" data-bs-html="true" style="opacity:.75;display:inline-block;background:#<?= substr(md5($item), 0, 6) ?>;height:8px;margin:4px 0;width:<?= ($time / $data["duration"]) * 100 ?>%"></span><?php endforeach; ?>
- </div>
- <ul>
- <?php foreach ($data["times"] as $item => $time): ?>
- <li><b><?= itemToName($item) ?>:</b> <?= round($time * 1000) ?> ms</li>
- <?php endforeach; ?>
- </ul>
-
- <h4>Reported failures</h4>
- <?php if (count($data["restored"]) < 1): ?>
- <p><i>The data updater has not reported any update failure in the last run.</i></p>
- <?php else: ?>
- <p>The following files have failed to update:</p>
- <ul>
- <?php foreach ($data["restored"] as $item): ?>
- <li><code><?= $item ?></code></li>
- <?php endforeach; ?>
- </ul>
- <?php endif; ?>
- </div>
-</div>
-
-<style>
- .element:hover {
- margin: 0 !important;
- height: 16px !important;
- opacity: 1 !important;
- }
-
- .element {
- transition: margin 200ms, height 200ms, opacity 200ms;
- }
-</style>
-
-<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>