Thumbs Tool for Removing Excessive Thumb Files

The Thumbs tool is available in FileCloud 23.241 and later.

The Thumbs tool removes excessive files in each user's storage space by regularly checking if thumbnails exceed a storage threshold (a certain percent of storage space), and deleting the oldest ones until the space they use is reduced by half. By default, when thumbnails exceed 20% of storage space they are removed until they take up half that amount of space (10%), but you may change the default.

The Thumbs tool runs automatically at regular intervals. However, you can also run it manually by accessing thumbs.php.
Windows location: C:\xampp\htdocs\resources\tools\storage
Linux location: /var/www/html/resources/tools/storage

This tool gives you additional options, such as deleting thumbnails for specific users and thumbnails that are more than a certain number of days old.

Running the Thumbs tool

To run the Thumbs tool, enter:

php thumbs.php clear -u user -p path -h hostname 

Parameters:

--user or -u (optional) - The user account (use all or omit the parameter for all user accounts)
--path or -p (optional) - The path of the storage to be calculated
--host or -h (optional) - The fully qualified name of the site in a multisite installation. Omit the option for standalone or default site.

Command options:

clear -f - Clears all thumbs until half the storage threshold (by default half of the threshold is 10%) is reached.
The force parameter --force or -f (optional) causes the clear command to skip the threshold check but still proceed to delete thumbnails until half the storage threshold (10%) is reached.
The following example checks if each user's thumbs take up over 20% of their storage, and if they do, deletes them until they only take up 10% of the user's storage.

php thumbs.php clear

 

clear-old -d - Clears all thumbs older than days specified in --days or -d (required)
The following example clears thumbs more than 8 days old in storage for users monicam, jasonp, and aliyag.

php thumbs.php clear-old -d 8 -u monicam,jasonp,aliyag 

 

clear-network -d -p - Clears all thumbs older than days specified in  --days or -d  (required) under the network path specified in --path or -p (required)
The following example clears thumbs in the network folder Accounts that are more than 5 days old for all users.

php thumbs.php clear-network -d 5 -p /EXTERNAL/Accounts -u all


help Displays help notes for the thumbs.php command.

php thumbs.php help


Example input and output

In the first example, the admin enters: php thumbs.php clear.  The tool checks the first user and finds that the user's thumbs do not take up 20% or more of storage space, so it does not do thumb cleanup. The it begins checking the next user:


In the next example, the admin enters: php thumbs.php clear-old --days 0. The tool goes through each thumbnail of every user and if it was created before today, deletes it.


In the next example, the admin enters: php thumbs.php clear-network --days 1 -p /EXTERNAL/external. The tool checks each thumbnail on the network path /external and deletes it if it is over 1 day old.

Changing the 20% threshold value

You may use the following setting to change the percent of storage space used by thumbnails that triggers Thumbs.php to delete  excessive files. When the Thumb tool runs, it will delete thumbnails until they take up half of that percent in storage.

To change the threshold:

  1. Open cloudconfig.php:
    Windows Location: XAMPP DIRECTORY/htdocs/config/cloudconfig.php
    Linux Location: /var/www/config/cloudconfig.php
  2. Add the following (16 is an example amount, you may enter any number).

    define('TONIDOCLOUD_THUMBS_CLEANNUP_QUOTA_PERCENTAGE_THRESHOLD', 16);

    The Thumb tool will run for users with 16% of their storage taken up by thumbnails, and it will delete half of them, leaving only 8% of storage filled with thumbnails.