Fix newline issues in tests.
[htmlpurifier/darkodev.git] / maintenance / flush-definition-cache.php
blob558ff3affc023d4f5ae10bb6485d04fb36a85922
1 #!/usr/bin/php
2 <?php
4 chdir(dirname(__FILE__));
5 require_once 'common.php';
6 assertCli();
8 /**
9 * @file
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
16 * the caches.
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]);
29 } else {
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";