summaryrefslogtreecommitdiff
path: root/includes/jobs/PKSystem.php
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-04-03 22:22:48 +0200
committerRaindropsSys <contact@minteck.org>2023-04-03 22:22:48 +0200
commit704e1c22efe6056b0fc2f59b2766f47e1c8d71cc (patch)
tree25c3c3980c115e7bcbc60e62f4b3d3f7fc184c71 /includes/jobs/PKSystem.php
parentbbf20f987bb6a7561be3d98518ddaa41b71eaf67 (diff)
downloadpluralconnect-704e1c22efe6056b0fc2f59b2766f47e1c8d71cc.tar.gz
pluralconnect-704e1c22efe6056b0fc2f59b2766f47e1c8d71cc.tar.bz2
pluralconnect-704e1c22efe6056b0fc2f59b2766f47e1c8d71cc.zip
Updated 19 files and added 12 files (automated)
Diffstat (limited to 'includes/jobs/PKSystem.php')
-rw-r--r--includes/jobs/PKSystem.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/includes/jobs/PKSystem.php b/includes/jobs/PKSystem.php
index 045eb67..6583e4f 100644
--- a/includes/jobs/PKSystem.php
+++ b/includes/jobs/PKSystem.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", false, $ctx);
if (trim($data) !== "" && $data !== false) {
+ echo("Data is valid, saved it\n");
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/general.json", $data);
+} else {
+ echo("Data is invalid\n");
} \ No newline at end of file