diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-03-29 22:05:35 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-03-29 22:05:35 +0100 |
commit | 5860551daa0f60103ad24e93da29f401a653f144 (patch) | |
tree | 9ad97e04152a6edc11d5096c87880978df39086a /includes/maintenance | |
parent | a51979ad60074db84af78a06d30fcb888ccb0b03 (diff) | |
download | pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.gz pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.bz2 pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.zip |
Updated 20 files, added 6 files, deleted 144 files and renamed .idea/ponycule.iml (automated)
Diffstat (limited to 'includes/maintenance')
-rw-r--r-- | includes/maintenance/clearUnused.php | 34 | ||||
-rw-r--r-- | includes/maintenance/deleteUnusedAssets.php | 4 |
2 files changed, 2 insertions, 36 deletions
diff --git a/includes/maintenance/clearUnused.php b/includes/maintenance/clearUnused.php deleted file mode 100644 index 499375b..0000000 --- a/includes/maintenance/clearUnused.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -$_SERVER['DOCUMENT_ROOT'] = "../.."; - -foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata"), function ($i) { return !str_starts_with($i, "."); }) as $file) { - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$file"), true); - echo("$file\n"); - - if (!isset($data["bitset"])) { - die(" No bitset?? wtf\n"); - } else { - $bits = str_split(substr(str_repeat("0", 48), 0, 48 - strlen(decbin($data["bitset"]))) . decbin($data["bitset"])); - echo(" Old:\n"); - echo(" " . str_replace("+", "\e[92m1\e[39m", str_replace("-", "\e[31m0\e[39m", implode("", str_replace("0", "-", str_replace("1", "+", $bits))))) . "\n"); - echo(" XX \n"); - - $bitsOld = implode("", $bits); - foreach ([27, 28] as $bit) { - $bits[$bit] = "0"; - } - - echo(" New:\n"); - echo(" " . str_replace("+", "\e[92m1\e[39m", str_replace("-", "\e[31m0\e[39m", implode("", str_replace("0", "-", str_replace("1", "+", $bits))))) . "\n"); - echo(" XX \n"); - echo(" Changed " . levenshtein($bitsOld, implode("", $bits)) . " bit(s)\n"); - - echo(" Backup made in " . substr($file, 0, -5) . "-old.json\n"); - copy($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$file", $_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . substr($file, 0, -5) . "-old.json"); - - $data["bitset"] = bindec(implode("", $bits)); - echo(" Saved to " . $file . "\n"); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$file", json_encode($data)); - } -}
\ No newline at end of file diff --git a/includes/maintenance/deleteUnusedAssets.php b/includes/maintenance/deleteUnusedAssets.php index bd7cd38..0c195a2 100644 --- a/includes/maintenance/deleteUnusedAssets.php +++ b/includes/maintenance/deleteUnusedAssets.php @@ -1,7 +1,7 @@ <?php global $action; -if (!isset($_SERVER['DOCUMENT_ROOT'])) $_SERVER['DOCUMENT_ROOT'] = "../.."; +if (!isset($_SERVER['DOCUMENT_ROOT']) || $_SERVER['DOCUMENT_ROOT'] === "") $_SERVER['DOCUMENT_ROOT'] = "../.."; if (!isset($action)) $action = "list"; if (isset($_SERVER["argv"][1])) { @@ -66,4 +66,4 @@ foreach (["heads", "bodies", "banners", "avatars"] as $t) { } } -echo($count . " file(s), leaving " . $left . " file(s), action: " . $action . "\n");
\ No newline at end of file +echo($count . " file(s), leaving " . $left . " file(s), action: " . $action . "\n"); |