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))) {
134 while (
false !== (
$filename = readdir($dh))) {
186 $base = is_null(
$base) ? HTMLPURIFIER_PREFIX .
'/HTMLPurifier/DefinitionCache/Serializer' :
$base;
202 $chmod =
$config->get(
'Cache.SerializerPermissions');
203 if ($chmod !== null) {
204 chmod(
$file, $chmod & 0666);
218 $chmod =
$config->get(
'Cache.SerializerPermissions');
219 if ($chmod === null) {
221 if (is_dir($directory))
return true;
222 return mkdir($directory);
224 if (!is_dir($directory)) {
226 if (!is_dir(
$base)) {
228 'Base directory ' .
$base .
' does not exist, 229 please create or change using %Cache.SerializerPath',
236 if (!mkdir($directory, $chmod)) {
238 'Could not create directory ' . $directory .
'',
262 if (is_writable($dir)) {
269 'Directory ' . $dir .
' does not exist',
274 if (function_exists(
'posix_getuid') && $chmod !== null) {
276 if (fileowner($dir) === posix_getuid()) {
278 $chmod = $chmod | 0700;
279 if (chmod($dir, $chmod)) {
282 } elseif (filegroup($dir) === posix_getgid()) {
283 $chmod = $chmod | 0070;
287 $chmod = $chmod | 0777;
290 'Directory ' . $dir .
' not writable, ' .
291 'please chmod to ' . decoct($chmod),
297 'Directory ' . $dir .
' not writable, ' .
298 '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