Exercise / HTMLPurifierBundle

HTML Purifier is a standards-compliant HTML filter library written in PHP.
http://htmlpurifier.org/
Other
275 stars 56 forks source link

Please can you help me explain what the cache is for? #83

Closed matthew-gill closed 2 years ago

matthew-gill commented 3 years ago

Hello 👋 Thanks for your support on this package, it's so helpful for us!

I have a quick question, if I may. I'd like to know more about the cache directory, and what is it used for?

We had a problem upgrading where we had two purifiers configured (loose and strict), originally we had two separate caches configured for each html profiles as that seemed the most sensible. After upgrading we got errors like this:

 User Warning: Base directory /Users/xxx/symfony/app/cache/loca_/htmlpurifier-loose does not exist,  
                      please create or change using %Cache.SerializerPath   

Once we removed the cache at a profile level and used the default_cache_serializer_path directive it worked.

Is it acceptable to use the same cache for multiple profiles (with different config) ?

And is the above a known issue?

Thanks in advance!

HeahDude commented 3 years ago

Hello, thank you for opening this issue and sorry for the late answer.

The cache is already unique based on the config name, so it is convenient to use the same default path in most cases. The cache is build during the warm up process, so you need to ensure the proper write access when it runs. Usually it can be useful to have a path per profile(s) in case you handle the deployment differently for them.

About the error message, it may have broken if you updated to last major versions of this bundle, have a look at the different README by selecting branches to make sure the %Cache.SerializerPath% is defined correctly.

I leave this issue open for now waiting for your feedback. But I don't think there is something we can fix here.

HeahDude commented 2 years ago

Closing for lack of feedback.