vlw.se/api/endpoints/about/languages/DELETE.php
Victor Westerlund e25b1b6689 feat: add language chart to about page (#14)
Replaces this section on the `/about` page:
![image](/attachments/67ac2f42-3784-4c69-9240-0a7961afb47d)
with:
![image](/attachments/fa073c9c-a016-4281-a3fb-30b7be95881f)

I will replace and fix the colors of the buttons after #15 is merged.

Reviewed-on: https://codeberg.org/vlw/vlw.se/pulls/14
2025-01-28 14:45:52 +00:00

22 lines
No EOL
577 B
PHP

<?php
use Reflect\Call;
use Reflect\Path;
use Reflect\Response;
const MSG_OK = "Cache file deleted";
const MSG_FAIL = "Cache file does not exist or can't be deleted";
class DELETE_AboutLanguages {
public function __construct() {}
// Delete languages cache file if it exists
public function main(): Response {
// Bail out if cache is not used
if (empty($_ENV["forgejo_languages"]["cache_file"])) {
return new Response(MSG_OK);
}
return unlink($_ENV["forgejo_languages"]["cache_file"]) ? new Response(MSG_OK) : new Response(MSG_FAIL, 404);
}
}