[3.1.0] Implement more validators, add in missing DEFAULTs for many tests.
[htmlpurifier/bfroehle.git] / maintenance / flush-definition-cache.php
blob220376208aa84db977c167322e51c63f46f2808f
1 #!/usr/bin/php
2 <?php
4 chdir(dirname(__FILE__));
5 require_once 'common.php';
6 assertCli();
8 /**
9 * Flushes the default HTMLDefinition serial cache
10 * @param Accepts one argument, cache type to flush; otherwise flushes all
11 * the caches.
14 echo "Flushing cache... \n";
16 require_once(dirname(__FILE__) . '/../library/HTMLPurifier.auto.php');
18 $config = HTMLPurifier_Config::createDefault();
20 $names = array('HTML', 'CSS', 'URI', 'Test');
21 if (isset($argv[1])) {
22 if (in_array($argv[1], $names)) {
23 $names = array($argv[1]);
24 } else {
25 echo "Did not recognized cache parameter {$argv[1]} as valid cache, aborting.\n";
26 exit;
30 foreach ($names as $name) {
31 echo " - Flushing $name\n";
32 $cache = new HTMLPurifier_DefinitionCache_Serializer($name);
33 $cache->flush($config);
36 echo "Cache flushed successfully.\n";