summaryrefslogtreecommitdiff
path: root/includes/jobs/UpdateAssets.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/jobs/UpdateAssets.php')
-rw-r--r--includes/jobs/UpdateAssets.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/jobs/UpdateAssets.php b/includes/jobs/UpdateAssets.php
index e52a6fa..0c05686 100644
--- a/includes/jobs/UpdateAssets.php
+++ b/includes/jobs/UpdateAssets.php
@@ -5,6 +5,8 @@ $_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);
if (!file_exists("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/avatars")) mkdir("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/avatars");
@@ -22,6 +24,7 @@ function downloadAssets($system, $path = null) {
$general = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$path/general.json"), true);
if ($options["type"] === "system") {
+ echo("Download system assets\n");
if (isset($general["avatar_url"])) {
$id = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $general["uuid"]);
echo(" /avatars/$id.webp\n");
@@ -45,6 +48,7 @@ function downloadAssets($system, $path = null) {
$id = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $general["uuid"]) . preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $member["uuid"]);
if ($options["type"] === "members") {
+ echo("Downloading member assets\n");
if (isset($member["avatar_url"])) {
echo(" /avatars/$id.webp\n");
file_put_contents("/tmp/img." . pathinfo($member['avatar_url'], PATHINFO_EXTENSION), file_get_contents($member['avatar_url']));
@@ -75,6 +79,7 @@ function downloadAssets($system, $path = null) {
}
if ($options["type"] === "ponytown") {
+ echo("Downloading Pony Town assets\n");
if (file_exists("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png")) {
$url = "" . $_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png";
} else {
@@ -91,9 +96,13 @@ function downloadAssets($system, $path = null) {
}
}
+echo("Downloading for gdapd\n");
downloadAssets("gdapd");
+
+echo("Downloading for ynmuc\n");
downloadAssets("ynmuc");
if (isset($app["other"]) && isset($app["other"]["id"]) && isset($app["other"]["token"])) {
+ echo("Downloading for other\n");
downloadAssets($app["other"]["id"], "other");
} \ No newline at end of file