From 08e32597df8ed2725f67b4d4b89d18bf988313de Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 2 Aug 2007 12:24:50 +0000 Subject: [PATCH] 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 --- NEWS | 3 ++- maintenance/flush-definition-cache.php | 14 ++++++++++++-- maintenance/generate-entity-file.php | 0 maintenance/merge-library.php | 0 tests/index.php | 0 5 files changed, 14 insertions(+), 3 deletions(-) mode change 100644 => 100755 maintenance/flush-definition-cache.php mode change 100644 => 100755 maintenance/generate-entity-file.php mode change 100644 => 100755 maintenance/merge-library.php mode change 100644 => 100755 tests/index.php diff --git a/NEWS b/NEWS index b84a19a7..a4c3d59c 100644 --- a/NEWS +++ b/NEWS @@ -11,7 +11,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier 2.1.0, unknown release date # flush-htmldefinition-cache.php superseded in favor of a generic - flush-definition-cache.php script + flush-definition-cache.php script, you can clear a specific cache + by passing its name as a parameter to the script ! Phorum mod implemented for HTML Purifier ! With %Core.AggressivelyFixLt, <3 and similar emoticons no longer trigger HTML removal in PHP5 (DOMLex). This directive is not necessary diff --git a/maintenance/flush-definition-cache.php b/maintenance/flush-definition-cache.php old mode 100644 new mode 100755 index 921a00c2..2b1567d1 --- a/maintenance/flush-definition-cache.php +++ b/maintenance/flush-definition-cache.php @@ -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); diff --git a/maintenance/generate-entity-file.php b/maintenance/generate-entity-file.php old mode 100644 new mode 100755 diff --git a/maintenance/merge-library.php b/maintenance/merge-library.php old mode 100644 new mode 100755 diff --git a/tests/index.php b/tests/index.php old mode 100644 new mode 100755