From 3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 23 Feb 2023 19:34:56 +0100 Subject: Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated) --- includes/refresh.php | 65 +++++++++++++++++++--------------------------------- 1 file changed, 24 insertions(+), 41 deletions(-) (limited to 'includes/refresh.php') diff --git a/includes/refresh.php b/includes/refresh.php index 922e708..3f3e7f4 100644 --- a/includes/refresh.php +++ b/includes/refresh.php @@ -1,22 +1,24 @@ $member) { + if (!isset($member["color"])) { + if (isset($member["avatar_url"])) { + $dominantColor = substr(ColorThief::getColor($member["avatar_url"], outputFormat: "hex"), 1); + } else { + $dominantColor = "ffffff"; + } + + $parsed[$index]["color"] = $dominantColor; + } + } + + $data = json_encode($parsed, JSON_PRETTY_PRINT); file_put_contents("./data/$fileName/members.json", $data); } $times["system-members-" . md5($id)] = microtime(true) - $currentOpStart; @@ -247,11 +243,6 @@ if (!is_link($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $app["other"]["id"] link($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other", $_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $app["other"]["id"]); } -echo("Calendar\n"); -$currentOpStart = microtime(true); -file_put_contents("./data/calendar/calendar.ics", file_get_contents($app["calendar"])); -$times["calendar"] = microtime(true) - $currentOpStart; - echo("Backing up...\n"); $lastBackup = (int)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/backup.txt")); @@ -272,21 +263,13 @@ $times["logo"] = microtime(true) - $currentOpStart; echo("Generated logo\n"); -echo("Generating favicons...\n"); - -$currentOpStart = microtime(true); -require_once "./icons.inc"; -$times["favicons"] = microtime(true) - $currentOpStart; - -echo("Generated favicons\n"); - echo("Fetching school information...\n"); file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/school.json", "{}"); $currentOpStart = microtime(true); -chdir("../school"); +chdir("./external/school"); exec("node index.js"); -chdir("../includes"); +chdir("../.."); $times["school"] = microtime(true) - $currentOpStart; echo("Fetched school information\n"); -- cgit