mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-31 03:10:09 +02:00
Fix flush-definition-cache to clear everything, and make it accept a parameter specifying which cache to flush. Also, set svn:executable to CLI scripts.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1340 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
14
maintenance/flush-definition-cache.php
Normal file → Executable file
14
maintenance/flush-definition-cache.php
Normal file → Executable file
@@ -3,6 +3,8 @@
|
||||
|
||||
/**
|
||||
* Flushes the default HTMLDefinition serial cache
|
||||
* @param Accepts one argument, cache type to flush; otherwise flushes all
|
||||
* the caches.
|
||||
*/
|
||||
|
||||
if (php_sapi_name() != 'cli') {
|
||||
@@ -16,8 +18,16 @@ require_once(dirname(__FILE__) . '/../library/HTMLPurifier.auto.php');
|
||||
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
|
||||
//$names = array('HTML', 'CSS', 'URI', 'Test');
|
||||
$names = array('URI');
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($names as $name) {
|
||||
echo " - Flushing $name\n";
|
||||
$cache = new HTMLPurifier_DefinitionCache_Serializer($name);
|
||||
|
Reference in New Issue
Block a user