mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-05 05:37:49 +02:00
Release 2.0.1, merged in 1181 to HEAD.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/strict@1255 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -4,6 +4,8 @@ require_once 'HTMLPurifier/DefinitionCache/Serializer.php';
|
||||
require_once 'HTMLPurifier/DefinitionCache/Null.php';
|
||||
|
||||
require_once 'HTMLPurifier/DefinitionCache/Decorator.php';
|
||||
require_once 'HTMLPurifier/DefinitionCache/Decorator/Memory.php';
|
||||
require_once 'HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
|
||||
|
||||
/**
|
||||
* Abstract class representing Definition cache managers that implements
|
||||
@@ -36,8 +38,8 @@ class HTMLPurifier_DefinitionCache
|
||||
*/
|
||||
function generateKey($config) {
|
||||
return $config->version . '-' . // possibly replace with function calls
|
||||
$config->get($this->type, 'DefinitionRev') . '-' .
|
||||
$config->getBatchSerial($this->type);
|
||||
$config->getBatchSerial($this->type) . '-' .
|
||||
$config->get($this->type, 'DefinitionRev');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,11 +49,17 @@ class HTMLPurifier_DefinitionCache
|
||||
* @param $config Instance of HTMLPurifier_Config to test against
|
||||
*/
|
||||
function isOld($key, $config) {
|
||||
list($version, $revision, $hash) = explode('-', $key, 3);
|
||||
if (substr_count($key, '-') < 2) return true;
|
||||
list($version, $hash, $revision) = explode('-', $key, 3);
|
||||
$compare = version_compare($version, $config->version);
|
||||
if ($compare > 0) return false;
|
||||
if ($compare == 0 && $revision >= $config->get($this->type, 'DefinitionRev')) return false;
|
||||
return true;
|
||||
// version mismatch, is always old
|
||||
if ($compare != 0) return true;
|
||||
// versions match, ids match, check revision number
|
||||
if (
|
||||
$hash == $config->getBatchSerial($this->type) &&
|
||||
$revision < $config->get($this->type, 'DefinitionRev')
|
||||
) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,4 +126,3 @@ class HTMLPurifier_DefinitionCache
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user