diff options
Diffstat (limited to 'includes/refresh.php')
-rw-r--r-- | includes/refresh.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/includes/refresh.php b/includes/refresh.php index 79e3b7f..320af54 100644 --- a/includes/refresh.php +++ b/includes/refresh.php @@ -1,5 +1,6 @@ <?php +$app = json_decode(file_get_contents("./app.json"), true); $start = microtime(true); @mkdir("./data"); @@ -47,10 +48,14 @@ function getSystem(string $id) { getSystem("gdapd"); // Raindrops getSystem("ynmuc"); // Cloudburst +echo("Calendar\n"); +$currentOpStart = microtime(true); +file_put_contents("./data/calendar.ics", file_get_contents($app["calendar"])); +$times["calendar"] = microtime(true) - $currentOpStart; + echo("Downloading images.\n"); if (!file_exists("./data/images")) mkdir("./data/images"); -$currentOpStart = microtime(true); foreach (json_decode(file_get_contents("./data/gdapd-members.json"), true) as $member) { $currentOpStart2 = microtime(true); echo(" " . $member['id'] . "\n"); @@ -68,9 +73,7 @@ foreach (json_decode(file_get_contents("./data/gdapd-members.json"), true) as $m } $times["images-gdapd-" . $member['id']] = microtime(true) - $currentOpStart2; } -$times["images-gdapd"] = microtime(true) - $currentOpStart; -$currentOpStart = microtime(true); foreach (json_decode(file_get_contents("./data/ynmuc-members.json"), true) as $member) { $currentOpStart2 = microtime(true); echo(" " . $member['id'] . "\n"); @@ -88,7 +91,6 @@ foreach (json_decode(file_get_contents("./data/ynmuc-members.json"), true) as $m } $times["images-ynmuc-" . $member['id']] = microtime(true) - $currentOpStart2; } -$times["images-ynmuc"] = microtime(true) - $currentOpStart; $currentOpStart = microtime(true); function isJson($string): bool { @@ -104,11 +106,13 @@ foreach ($files as $file) { } $times["restore"] = microtime(true) - $currentOpStart; -$time = (microtime(true) - $start); +require_once "./backup.php"; + +$time = array_sum($times); echo("Completed in " . $time . " seconds.\n"); file_put_contents("./data/refresh.json", json_encode([ - "timestamp" => time(), + "timestamp" => microtime(true), "duration" => $time, "restored" => $restored, "times" => $times |