.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt ================== EXT: Cache cleaner ================== :Author: Kasper Skårhøj :Created: 2002-11-01T00:32:00 :Changed: 2013-12-08T20:13:43 :Classification: cachecleaner :Keywords: forAdmins, forIntermediates :Author: François Suter :Email: typo3@cobweb.ch :Info 4: :Language: en |img-1| |img-2| EXT: Cache cleaner - cachecleaner .. _EXT-Cache-cleaner: EXT: Cache cleaner ================== Extension Key: cachecleaner Language: en Keywords: forAdmins, forIntermediates Copyright 2009-2013, François Suter, This document is published under the Open Content License available from http://www.opencontent.org/opl.shtml The content of this document is related to TYPO3 \- a GNU/GPL CMS/Framework available from www.typo3.org .. _Table-of-Contents: Table of Contents ----------------- `EXT: Cache cleaner 1 <#__RefHeading__492_1805741445>`_ **`Introduction 3 <#__RefHeading__494_1805741445>`_** `What does it do? 3 <#__RefHeading__496_1805741445>`_ `Credits 3 <#__RefHeading__498_1805741445>`_ `Questions? 3 <#__RefHeading__500_1805741445>`_ **`Installation 4 <#__RefHeading__502_1805741445>`_** `Extension configuration 4 <#__RefHeading__504_1805741445>`_ `Compatibility 4 <#__RefHeading__506_1805741445>`_ **`Administration 5 <#__RefHeading__508_1805741445>`_** `Running the cache cleaner 5 <#__RefHeading__510_1805741445>`_ `Configuring the cache cleaner 5 <#__RefHeading__512_1805741445>`_ `Post-flight check 6 <#__RefHeading__514_1805741445>`_ **`Known problems 7 <#__RefHeading__516_1805741445>`_** **`To-Do list 8 <#__RefHeading__518_1805741445>`_** .. _Introduction: Introduction ------------ .. _What-does-it-do: What does it do? ^^^^^^^^^^^^^^^^ This extension provides a new submodule for the lowlevel cleaner tool, designed to delete obsolete records from the various TYPO3 cache tables. It can also be used to delete records from any table based on a certain age limit. Since TYPO3 CMS 4.6, a similar feature is included in the Core as a Scheduler task (see "Compatibility" in the "Installation" chapter). As such this extension is no longer actively developed. .. _Credits: Credits ^^^^^^^ The development of this extension was sponsored by Manpower SA (Switzerland). .. _Questions: Questions? ^^^^^^^^^^ If you have any questions about this extension, please ask them in the TYPO3 English mailing list (typo3.english), so that others can benefit from the answers. .. _Installation: Installation ------------ Once the extension is downloaded and installed, the new tool is available for use with the lowlevel\_cleaner CLI script, but it must still be properly configured (see “Administration” below). .. _Extension-configuration: Extension configuration ^^^^^^^^^^^^^^^^^^^^^^^ There's a single configuration option available. **debug** : check this box to have the cache cleaner log its actions into the Developer's Log. This may be convenient for checking what the cache cleaner when it is not being run manually. Note that to actually log anything you will need a dev-logging extension, such as “devlog”. .. _Compatibility: Compatibility ^^^^^^^^^^^^^ The functionality of this extension is provided by the TYPO3 CMS Core itself since version 4.6, by the "Table garbage collection" task of the Scheduler. The configuration of the Scheduler task uses a similar syntax. Only the "location" is different. Instead of: :: $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cachecleaner'] use: :: $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_scheduler_TableGarbageCollection']['options']['tables'] .. _Administration: Administration -------------- .. _Running-the-cache-cleaner: Running the cache cleaner ^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Running-lowlevel-scripts: Running lowlevel scripts """""""""""""""""""""""" If you have never run the lowlevel\_cleaner scripts before, you should first take a look at some of the documentation available on this topic: - the :code:`HOWTO\_clean\_up\_TYPO3\_installations.txt` file provided by the lowlevel system extension ( :code:`typo3/sysext/lowlevel` ); - very complete articles written by Michiel Roos in his blog: - `http://typofree.org/article/archive/2008/june/title/typo3-housekeepin g/ `_ - `http://typofree.org/article/archive/2008/june/title/typo3 -housekeeping-part-2/ `_ .. _Cache-cleaner-options: Cache cleaner options """"""""""""""""""""" The cache cleaner script provides the following command-line options: .. ### BEGIN~OF~TABLE ### .. _optimize: --optimize ~~~~~~~~~~ .. container:: table-row Option --optimize Description Runs the OPTIMIZE command on all tables after having cleaned them up. **Note:** this will work only with MySQL. Don't use this option if you're running TYPO3 with a different database system. .. _tables-table-names: --tables table\_names ~~~~~~~~~~~~~~~~~~~~~ .. container:: table-row Option --tables table\_names Description Restricts the clean up to only the given tables (comma-separated list) instead of all the configured tables (see “Configuring the cache cleaner” below). If a table is given that is not configured, it will be ignored. .. ###### END~OF~TABLE ###### **Example:** Here's an example of command-line call to the cache cleaner: :: /usr/local/bin/php /var/www/mysite/typo3/cli_dispatch.phpsh lowlevel_cleaner tx_cachecleaner_cache -r --AUTOFIX -i --optimize --tables cache_hash The paths to the PHP executable and the cli dispatch script have to be adapted of course. The “-r” option indicates that the script should actually be run and the “--AUTOFIX” option indicates that the clean up should be applied. The “-i” option makes the process interactive, which means that the user will be queried for confirmation for every table. The “--optimize” option will ensure that the MySQL-specific OPTIMIZE command will be run on each table after the clean up. Lastly the “--tables” option restricts the actual run to cleaning up only the :code:`cache\_hash` table. .. _Configuring-the-cache-cleaner: Configuring the cache cleaner ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Before running this tool, it is necessary to configure it. The cache cleaner provides an example configuration in the :code:`configuration\_sample.php` file. It is reproduced here: :: $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cachecleaner'] = array( 'tables' => array( 'cache_pages' => array( 'expireField' => 'expires' ), 'cache_hash' => array( 'dateField' => 'tstamp', 'expirePeriod' => '7d' ), 'sys_log' => array( 'dateField' => 'tstamp', 'expirePeriod' => '1m' ) ) ); The configuration is a list of all tables that should be cleaned up. For each table, you have to define whether it has an expiry field (i.e. a field containing an already calculated expiration date) or if the cleaner has to rely on a simple date field, with an age limit. .. ### BEGIN~OF~TABLE ### .. _expireField: expireField """"""""""" .. container:: table-row Key expireField Type string Description Name of the field that contains an expiry date. This will often be “expire” or “expires”. .. _dateField: dateField """"""""" .. container:: table-row Key dateField Type string Description When a table has no explicit expiry field, one can define a datetime field to be used instead. This will be used in combination with the expirePeriod property described below. .. _expirePeriod: expirePeriod """""""""""" .. container:: table-row Key expirePeriod Type integer/string Description Used to define a period after which a record should be considered obsolete and thus deleted. This can be a simple number, in which case it is considered to be a number of days. It can also be a number followed by one of the following: “h” for “hour”, “d” for “day”, “w” for “week” or “m” for “month”. **Examples:** - 5 => 5 days - 3h => 3 hours - 6d => 6 days - 2w => 2 weeks - 6m => 6 months Any record whose “dateField” is older than this period of time will be deleted. .. ###### END~OF~TABLE ###### Going back to the sample configuration shown above, it means that the :code:`cache\_pages` table will be cleaned up according to the existing “expires” field. The :code:`cache\_hash` table, on the contrary, has no such field. Instead age calculations will be based on the “tstamp” field and any record older than 7 days will be deleted. The same for the :code:`sys\_log` table, but for a period of 1 month. The configuration can be written in the :code:`localconf.php` file or in some extension's :code:`ext\_localconf.php` . The configuration cache must be cleared after any change, as usual. If no tables are configured, the script will output a message to that effect. .. _What-tables-to-clean-up: What tables to clean up? """""""""""""""""""""""" As its name implies, this extension is mostly targeted at clearing up old entries in TYPO3's various cache tables (or those of other extensions, like RealURL). However there are also quite a few other tables where data accumulates without limit. It is a good practice to remove old entries at regular intervals from such tables too. Good candidates are :code:`sys\_log` and :code:`sys\_history` , or any such kind of logging tables. .. _Post-flight-check: Post-flight check ^^^^^^^^^^^^^^^^^ Just like the other lowlevel\_cleaner tools, this script is meant to be run at some fixed time via a cron job, ideally when traffic on the web site is low. This will most likely happen when nobody is watching. There are several possibilities for checking what happened at a later point: - write the command-line ouput of the lowlevel\_cleaner into a log file; - enable the debug option and check out the Developer's Log; - check out the Log module in the TYPO3 backend. Some general information about execution of the cache cleaner is written there. This logging cannot be disabled, contrary to the debug logging. .. _Known-problems: Known problems -------------- None to date. Please report any problem to the TYPO3 English mailing list (typo3.english) or submit a bug report to the extension's bug tracker (http://forge.typo3.org/projects/extension- cachecleaner/issues). .. _To-Do-list: To-Do list ---------- No further development will take place. 8 .. ######CUTTER_MARK_IMAGES###### .. |img-1| image:: img-1.png .. :align: left .. |img-2| image:: img-2.png .. :border: 0 .. :height: 21 .. :hspace: 9 .. :id: Grafik2 .. :name: Grafik2 .. :width: 87