17 if (file_exists(
$file)) {
54 if (!file_exists(
$file)) {
70 if (!file_exists(
$file)) {
73 return unserialize(file_get_contents(
$file));
83 if (!file_exists(
$file)) {
106 while (
false !== (
$filename = readdir($dh))) {
133 while (
false !== (
$filename = readdir($dh))) {
183 $base =
$config->get(
'Cache.SerializerPath');
184 $base = is_null($base) ? HTMLPURIFIER_PREFIX .
'/HTMLPurifier/DefinitionCache/Serializer' : $base;
200 $chmod =
$config->get(
'Cache.SerializerPermissions');
201 if ($chmod === null) {
204 $chmod = $chmod & 0666;
205 chmod(
$file, $chmod);
219 $chmod =
$config->get(
'Cache.SerializerPermissions');
220 if (!is_dir($directory)) {
222 if (!is_dir($base)) {
224 'Base directory ' . $base .
' does not exist, 225 please create or change using %Cache.SerializerPath',
232 if ($chmod === null) {
234 'Base directory ' . $base .
' does not exist, 235 please create or change using %Cache.SerializerPath',
240 if ($chmod !== null) {
241 mkdir($directory, $chmod);
247 'Base directory ' . $base .
' does not exist, 248 please create or change using %Cache.SerializerPath',
269 if (is_writable($dir)) {
276 'Directory ' . $dir .
' does not exist',
281 if (function_exists(
'posix_getuid') && $chmod !== null) {
283 if (fileowner($dir) === posix_getuid()) {
285 $chmod = $chmod | 0700;
286 if (chmod($dir, $chmod)) {
289 } elseif (filegroup($dir) === posix_getgid()) {
290 $chmod = $chmod | 0070;
294 $chmod = $chmod | 0777;
297 'Directory ' . $dir .
' not writable, ' .
298 'please chmod to ' . decoct($chmod),
304 'Directory ' . $dir .
' not writable, ' .
305 'please alter file permissions',
generateBaseDirectoryPath($config)
Generates path to base directory that contains all definition type serials.
Abstract class representing Definition cache managers that implements useful common methods and is a ...
generateDirectoryPath($config)
Generates the path to the directory contain this cache's serial files.
checkDefType($def)
Checks if a definition's type jives with the cache's type.
_prepareDir($config)
Prepares the directory that this type stores the serials in.
_write($file, $data, $config)
Convenience wrapper function for file_put_contents.
generateFilePath($config)
Generates the file path to the serial file corresponding to the configuration and definition name...
_testPermissions($dir, $chmod)
Tests permissions on a directory and throws out friendly error messages and attempts to chmod it itse...
isOld($key, $config)
Tests whether or not a key is old with respect to the configuration's version and revision number...
generateKey($config)
Generates a unique identifier for a particular configuration.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file