DO NOT USE AT ALLBACKUP YOUR DATABASE AND DATA DIRECTORY BEFORE YOU USE THIS SCRIPT
If you have been using hMail for long periods of time and upgraded all the way up from V4 as new releases have emerged then you may have orphaned files lurking in the data and sub directories. AV and other anti spam mechanisms could sometimes lock a file at which point it's not removed (this doesn't happen any more).
I have written a PHP script that recurses through the accounts (user selected) and checks files against MySQL database entries. If there is no corresponding database entry the file is orphaned and can be removed. This script also can remove empty directories for you if you select the option.
I doubt I will expand on this script any further and will not
be adding any more features unless I feel it's extremely useful. I will not be adding support to recurse through every domain and account in one go as PHP would time out before its done (unless you start messing with timeout values under PHP.ini) and will place your database under heavy load. If you want it to do that then feel free to modify this script to do so.
Once you have downloaded the file open it up in notepad++ or similar and alter the config values at the top of the script and uploaded it to your webserver.
Make sure that PHP has the correct permissions to delete files and directories from hMail's data directory else this script is pretty useless.
This script is potentially dangerous if you don't know what you are doing. I have restricted the script to only allow access to specific IP addresses (configurable at the top of the script).
img1.png [ 46.08 KiB | Viewed 10080 times ]
img2.png [ 14.86 KiB | Viewed 10034 times ]
img3.png [ 18.52 KiB | Viewed 10034 times ]