diff options
Diffstat (limited to 'includes/refresh.php')
-rw-r--r-- | includes/refresh.php | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/includes/refresh.php b/includes/refresh.php index 18c01ed..fe01414 100644 --- a/includes/refresh.php +++ b/includes/refresh.php @@ -161,19 +161,31 @@ function getSystem(string $id) { echo(" Switches\n"); $currentOpStart = microtime(true); - echo(" Part 1/3\n"); + echo(" Part 1/6\n"); $switches1 = json_decode(file_get_contents("https://pluralkit.equestria.dev/v2/systems/$id/switches"), true); $oldest = $switches1[count($switches1) - 1]["timestamp"]; - echo(" Part 2/3\n"); + echo(" Part 2/6\n"); $switches2 = json_decode(file_get_contents("https://pluralkit.equestria.dev/v2/systems/$id/switches?before=$oldest"), true); $oldest = $switches2[count($switches2) - 1]["timestamp"]; - echo(" Part 3/3\n"); + echo(" Part 3/6\n"); $switches3 = json_decode(file_get_contents("https://pluralkit.equestria.dev/v2/systems/$id/switches?before=$oldest"), true); + $oldest = $switches3[count($switches3) - 1]["timestamp"]; - if ($switches1 !== null && $switches2 !== null && $switches3 !== null) { - file_put_contents("./data/$id/switches.json", json_encode([...$switches1, ...$switches2, ...$switches3], JSON_PRETTY_PRINT)); + echo(" Part 4/6\n"); + $switches4 = json_decode(file_get_contents("https://pluralkit.equestria.dev/v2/systems/$id/switches?before=$oldest"), true); + $oldest = $switches4[count($switches4) - 1]["timestamp"]; + + echo(" Part 5/6\n"); + $switches5 = json_decode(file_get_contents("https://pluralkit.equestria.dev/v2/systems/$id/switches?before=$oldest"), true); + $oldest = $switches5[count($switches5) - 1]["timestamp"]; + + echo(" Part 6/6\n"); + $switches6 = json_decode(file_get_contents("https://pluralkit.equestria.dev/v2/systems/$id/switches?before=$oldest"), true); + + if ($switches1 !== null && $switches2 !== null && $switches3 !== null && $switches4 !== null && $switches5 !== null && $switches6 !== null) { + file_put_contents("./data/$id/switches.json", json_encode([...$switches1, ...$switches2, ...$switches3, ...$switches4, ...$switches5, ...$switches6], JSON_PRETTY_PRINT)); $times["system-switches-$id"] = microtime(true) - $currentOpStart; } } |