Cleaning your temporary files directory

Your Temporary Files directory (called Temp Folder in your site's Global Configuration page) is the directory where Joomla! and its extensions put short-lived files. For example, when Joomla is updating itself or installing an update to an extension it stores several files there.

One problem with that directory is that sometimes files can get stuck in it, when the code that created them fails to run to completion and does not clean them up. This not only causes a space problem — as these files take up valuable disk space — but can also compromise your site's security as these files may contain potentially sensitive information, or may be executable PHP files. While the latter issue can be usually worked around by using the front-end protection mode in the .htaccess Maker feature of Admin Tools Professional, the proper solution is to periodically clean the contents of that directory.

Admin Tools Core and Admin Tools Professional include the Clean Temp-directory feature which will do that for you with a single click! More specifically, it will automatically remove all files and directories from your Temp-directory except index.html, index.htm, web.config and .htaccess, if any of those files exists.

Please note that Admin Tools will only remove files and folders created at least 60 seconds before you run this feature. This is a precaution to avoid accidentally deleting temporary files currently in use, e.g. the files Joomla needs to use while updating an extension.

Admin Tools lists the files and folders in your site's configured temporary directory and deletes them using Joomla's filesystem API. There are some points which arise from that:

  • NEVER, EVER, SET YOUR TEMPORARY DIRECTORY TO YOUR SITE'S ROOT OR ANY OTHER FOLDER THE CONTENTS OF WHICH YOU WOULD LIKE TO KEEP. Admin Tools will not prevent you from doing something “obviously” silly so as not to prevent you from doing something clever. You are responsible for your choices and your actions. If you tell Admin Tools to delete the temporary folder's contents it will do so, EVEN IF you have mistakenly used a folder you want to keep as your temporary folder. In other words, nobody will stop you from shooting your feet.

  • Your temporary directory is what you have configured in your site's Global Configuration page, in the Temp-directory option. If you see something like tmp or /tmp in there please note that it is NOT the same as the directory inside your site named tmp. The directory inside your site is a full path which usually looks like /home/myuser/public_html/tmp.

  • If your temporary directory is outside your site's root or contains double dots (e.g. ../tmp) Joomla! will REFUSE to list (and delete) its contents. This is not a bug in Admin Tools, it's how Joomla! itself is designed to work and is a sane security precaution we will never attempt to circumvent. Do note that a path like that will also prevent you from saving your site's Global Configuration.

  • Being able to delete the contents of the directory depends largely on its permissions and the permissions of its contents. If Joomla! doesn't have directory listing permissions to this directory it can create temporary files just fine and delete them when it still knows their name (right after creating them), but not when Admin Tools asks it to list and delete the contents of the temp-directory. The reason is quite technical: Joomla! can't list the contents of the directory, therefore it can't know which files / folders it contains and as a result doesn't know what it has to delete. This is how filesystems work, not a bug in Admin Tools.