Move all CLI scripts except common.cron to the "scripts" directory under the corresponding module

This commit is contained in:
Kijin Sung 2025-05-21 18:07:04 +09:00
parent 792ea89e64
commit 9ca2f79dce
14 changed files with 490 additions and 394 deletions

View file

@ -1,41 +1,8 @@
<?php
/**
* This script deletes old thumbnails.
*
* Thumbnails can take up a large amount of disk space and inodes if they are
* allowed to accumulate. Since most websites only need thumbnails for recent
* posts, it is okay to delete old thumbnails.
*
* Do not run this script if you have a gallery-style module where visitors
* regularly view old posts. This will force thumbnails to be regenerated,
* increasing the server load and making your pages load slower.
*
* This script only works on Unix-like operating systems where the 'find'
* command is available.
* This script is @deprecated.
* Please invoke: php index.php file.cleanThumbnails
*/
require_once __DIR__ . '/common.php';
// Delete thumbnails older than this number of days.
$days = 90;
// Initialize the exit status.
$exit_status = 0;
// Delete old thumbnails.
passthru(sprintf('find %s -type f -mtime +%d -delete', escapeshellarg(RX_BASEDIR . 'files/thumbnails'), abs($days)), $result);
if ($result == 0)
{
echo "Successfully deleted all thumbnails older than $days days.\n";
}
else
{
echo "Error while deleting thumbnails older than $days days.\n";
$exit_status = $result;
}
// Set the exit status if there were any errors.
if ($exit_status != 0)
{
exit($exit_status);
}
require_once RX_BASEDIR . 'modules/file/scripts/cleanThumbnails.php';