ezyang / ezyang/htmlpurifier

Cache directory

Open
#105 12 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.4k
Forks
361
Avg merge
3d 41m
Merged PRs (30d)
2

Description

Hello,

I have a warning in production : Directory var/cache/html_purifier/HTML not writable, please chmod to 777.

but when I deploy I delete cache files and recreate it :

rm -rf var/cache/* && mkdir var/cache/html_purifier && chmod 777 var/cache/html_purifier

and I configured the cache as this :

'Cache.SerializerPath' => __DIR__.'/../../var/cache/html_purifier'

so, two things :

  • I don't understand why the library can't access a folder it create himself. I didn't create the HTML folder, the code of the library did. It shoul'd be allowed to write in it.

  • Actually, even the "html_purifier" folder should be created by the library. As a developper my job is to make the "cache" folder writable and config librairies which need it, not to create every "root" folder in it for each library.

For example, twig config is

'cache' => __DIR__.'/../../var/cache/twig',

but I never create this twig folder. Twig create it as 777, and furthermore chmod files with the umask I have in my index.php.

I've read some code of Serailizer.php, _prepareDir and _testPermissions, I think it is just too much complex for what it is supposed to do, and the use of it (developper have to create the folder) not user friendy.

Maybe have a look on twig code, and keep it simple ?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect Serializer.php, especially _prepareDir and _testPermissions, to understand how the configured cache path and its HTML subdirectory are handled. Compare the behavior with the linked Twig Cache Filesystem implementation. Done means the configured cache location works without manually creating the library-specific directories and the existing permission behavior remains covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.