2007-05-27 14:27:54 +00:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
|
2007-08-02 12:45:15 +00:00
|
|
|
require_once 'common.php';
|
|
|
|
assertCli();
|
|
|
|
|
2007-05-27 14:27:54 +00:00
|
|
|
/**
|
2007-06-20 21:39:28 +00:00
|
|
|
* Flushes the default HTMLDefinition serial cache
|
2007-08-02 12:24:50 +00:00
|
|
|
* @param Accepts one argument, cache type to flush; otherwise flushes all
|
|
|
|
* the caches.
|
2007-05-27 14:27:54 +00:00
|
|
|
*/
|
|
|
|
|
2007-08-01 14:55:09 +00:00
|
|
|
echo "Flushing cache... \n";
|
2007-05-27 14:27:54 +00:00
|
|
|
|
|
|
|
require_once(dirname(__FILE__) . '/../library/HTMLPurifier.auto.php');
|
|
|
|
|
2007-06-20 21:39:28 +00:00
|
|
|
$config = HTMLPurifier_Config::createDefault();
|
|
|
|
|
2007-08-02 12:24:50 +00:00
|
|
|
$names = array('HTML', 'CSS', 'URI', 'Test');
|
|
|
|
if (isset($argv[1])) {
|
|
|
|
if (in_array($argv[1], $names)) {
|
|
|
|
$names = array($argv[1]);
|
|
|
|
} else {
|
|
|
|
echo "Did not recognized cache parameter {$argv[1]} as valid cache, aborting.\n";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-01 14:55:09 +00:00
|
|
|
foreach ($names as $name) {
|
|
|
|
echo " - Flushing $name\n";
|
|
|
|
$cache = new HTMLPurifier_DefinitionCache_Serializer($name);
|
|
|
|
$cache->flush($config);
|
|
|
|
}
|
2007-05-27 14:27:54 +00:00
|
|
|
|
|
|
|
echo 'Cache flushed successfully.';
|
|
|
|
|