diff options
author | RaindropsSys <contact@minteck.org> | 2023-03-29 22:44:18 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-03-29 22:44:18 +0200 |
commit | 05af3950c40e5724f1cd9ed662528c0832fb1297 (patch) | |
tree | b1e56bc989bffb0eee33c520b62cced63805acb9 /includes/jobs | |
parent | e98e95d89939cdc1252d02df04ae8d91c6aa8c92 (diff) | |
download | pluralconnect-05af3950c40e5724f1cd9ed662528c0832fb1297.tar.gz pluralconnect-05af3950c40e5724f1cd9ed662528c0832fb1297.tar.bz2 pluralconnect-05af3950c40e5724f1cd9ed662528c0832fb1297.zip |
Updated 3 files and deleted includes/jobs/CleanupDocs.php (automated)
Diffstat (limited to 'includes/jobs')
-rw-r--r-- | includes/jobs/CleanupDocs.php | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/includes/jobs/CleanupDocs.php b/includes/jobs/CleanupDocs.php deleted file mode 100644 index 70f37b9..0000000 --- a/includes/jobs/CleanupDocs.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -$options = json_decode($argv[1], true); -$_SERVER['DOCUMENT_ROOT'] = "../.."; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/composer/vendor/autoload.php'; -use ColorThief\ColorThief; - -$documents = array_map(function ($i) { - return [ - "id" => substr($i, 0, -5), - ...(json_decode(file_get_contents("./data/docs/" . $i), true) ?? []) - ]; -}, array_filter(scandir("./data/docs"), function ($i) { - return !str_starts_with($i, ".") && str_ends_with($i, ".json"); -})); - -$deletable = array_values(array_filter($documents, function ($i) { - return str_starts_with(strip_tags($i["contents"]), "/delete"); -})); - -foreach ($deletable as $item) { - if (time() - $item["last"]["date"] > 86400) { - unlink("./data/docs/" . $item["id"] . ".json"); - } -}
\ No newline at end of file |