diff options
Diffstat (limited to 'includes/jobs/PKFronters.php')
-rw-r--r-- | includes/jobs/PKFronters.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/includes/jobs/PKFronters.php b/includes/jobs/PKFronters.php index 2649b7d..feb7fd3 100644 --- a/includes/jobs/PKFronters.php +++ b/includes/jobs/PKFronters.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,8 +28,12 @@ if ($app["other"]["id"] === $system) { ]); } +echo("Fetching...\n"); $data = file_get_contents("https://pluralkit.equestria.dev/v2/systems/$system/fronters", false, $ctx); if (trim($data) !== "" && $data !== false) { + echo("Data is valid, saved it\n"); file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", $data); +} else { + echo("Data is invalid\n"); }
\ No newline at end of file |