4 chdir(dirname(__FILE__
));
5 require_once 'common.php';
10 * Flushes the definition serial cache. This file should be
11 * called if changes to any subclasses of HTMLPurifier_Definition
12 * or related classes (such as HTMLPurifier_HTMLModule) are made. This
13 * may also be necessary if you've modified a customized version.
15 * @param Accepts one argument, cache type to flush; otherwise flushes all
19 echo "Flushing cache... \n";
21 require_once(dirname(__FILE__
) . '/../library/HTMLPurifier.auto.php');
23 $config = HTMLPurifier_Config
::createDefault();
25 $names = array('HTML', 'CSS', 'URI', 'Test');
26 if (isset($argv[1])) {
27 if (in_array($argv[1], $names)) {
28 $names = array($argv[1]);
30 throw new Exception("Cache parameter {$argv[1]} is not a valid cache");
34 foreach ($names as $name) {
35 echo " - Flushing $name\n";
36 $cache = new HTMLPurifier_DefinitionCache_Serializer($name);
37 $cache->flush($config);
40 echo "Cache flushed successfully.\n";