aboutsummaryrefslogtreecommitdiff
path: root/_site/admin/status/index.php
blob: 2698c5b4c5de7c82f6ef07be9fb501ded0aded18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php $__ADMIN = true; $_TITLE = "Data Sync Status - UnchainedTech Administration"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php"; ?>

<div class="container" style="margin-top:30px;text-align: center;">
    <h2>Data Sync Status</h2>
    <p>Check if everything is good!</p>
</div>

<div class="container">
    <ul>
        <?php

        $commit = json_decode(gh_api("repos/Minteck/UnchainedTech-Content/commits"), true)[0];
        if (!isset($commit["commit"]["verification"]) || !isset($commit["commit"]["verification"]["verified"]) || !$commit["commit"]["verification"]["verified"]) {
            echo("<li class='list-admin-warning'>This version is <b>not</b> digitally signed, its content may have been compromised.</li>");
        }

        ?>
        <li><b>Upstream version:</b> <?php

            echo(substr($commit["sha"], 0, 7) . " « " . $commit["commit"]["message"] . " » · commited by " . $commit["commit"]["author"]["name"]);

            ?></li>
        <li><b>Downstream version:</b> <?php

            echo(substr(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/../_posts/.git/refs/heads/master"), 0, 7));

            ?></li>
        <li><?php

            if (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/../_posts/.git/refs/heads/master")) === trim($commit["sha"])) {
                echo("Downstream is up to date");
            } else {
                echo("Downstream <b>rebase needed</b>");
            }

            ?></li>
    </ul>
</div>

<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/footer.php"; ?>