From 704e1c22efe6056b0fc2f59b2766f47e1c8d71cc Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Mon, 3 Apr 2023 22:22:48 +0200 Subject: Updated 19 files and added 12 files (automated) --- includes/jobs/PKMembers.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'includes/jobs/PKMembers.php') diff --git a/includes/jobs/PKMembers.php b/includes/jobs/PKMembers.php index 536853d..7bcb242 100644 --- a/includes/jobs/PKMembers.php +++ b/includes/jobs/PKMembers.php @@ -5,10 +5,13 @@ $_SERVER['DOCUMENT_ROOT'] = "../.."; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/composer/vendor/autoload.php'; use ColorThief\ColorThief; +echo("Loading...\n"); + $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); $system = $options["system"]; if ($app["other"]["id"] === $system) { + echo("Using authentication\n"); $ctx = stream_context_create([ 'http' => [ 'method' => 'GET', @@ -17,6 +20,7 @@ if ($app["other"]["id"] === $system) { ] ]); } else { + echo("Not using authentication\n"); $ctx = stream_context_create([ 'http' => [ 'method' => 'GET' @@ -24,9 +28,11 @@ if ($app["other"]["id"] === $system) { ]); } +echo("Fetching...\n"); $data = file_get_contents("https://pluralkit.equestria.dev/v2/systems/$system/members", false, $ctx); if (trim($data) !== "" && $data !== false) { + echo("Data is valid, saved it\n"); $parsed = json_decode($data, true); foreach ($parsed as $index => $member) { @@ -47,7 +53,10 @@ if (trim($data) !== "" && $data !== false) { $data = json_encode($parsed, JSON_PRETTY_PRINT); file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/members.json", $data); +} else { + echo("Data is invalid\n"); } +echo("Cleared cache\n"); file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/navigation.json", "{}"); file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json", "{}"); \ No newline at end of file -- cgit