2007-05-27 14:27:54 +00:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
|
2008-01-07 00:17:49 +00:00
|
|
|
chdir(dirname(__FILE__));
|
2007-08-02 12:45:15 +00:00
|
|
|
require_once 'common.php';
|
|
|
|
assertCli();
|
|
|
|
|
2007-05-27 14:27:54 +00:00
|
|
|
/**
|
2008-04-03 22:39:50 +00:00
|
|
|
* @file
|
|
|
|
* Flushes the definition serial cache. This file should be
|
|
|
|
* called if changes to any subclasses of HTMLPurifier_Definition
|
|
|
|
* or related classes (such as HTMLPurifier_HTMLModule) are made. This
|
|
|
|
* may also be necessary if you've modified a customized version.
|
|
|
|
*
|
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 {
|
2008-04-03 20:52:08 +00:00
|
|
|
throw new Exception("Cache parameter {$argv[1]} is not a valid cache");
|
2007-08-02 12:24:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2007-11-05 05:01:51 +00:00
|
|
|
echo "Cache flushed successfully.\n";
|
2007-05-27 14:27:54 +00:00
|
|
|
|