Expose cache_path config, catch exceptions cleaning cache on config save#13520
Expose cache_path config, catch exceptions cleaning cache on config save#13520wilsonge merged 1 commit intojoomla:stagingfrom mbabker:config-cache-fixes
Conversation
|
I changed the cache path to a non existen folder and i got an exception: Also is the site cache folder or the admin cache folder? |
The
Seems to be consistently inconsistent. The |
Oh ... then all is fine! I has afraid this one time it would be consistently consistent. 😄
Agree |
|
I have tested this item ✅ successfully on 56ce7b8 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13520. |
1 similar comment
|
I have tested this item ✅ successfully on 56ce7b8 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13520. |
|
RTC |
|
@joomla-bot are you drunk? |
|
Maybe change to |
|
Feel free to PR it. |
|
Done. |
Summary of Changes
The code already has support for a
cache_pathparameter which allows a user to specify a custom cache path when using the filesystem for caching. This parameter is now exposed to the global configuration.When saving the global configuration, the code checking for the filesystem being usable did not account for this parameter and always used the hardcoded
JPATH_SITE . '/cache'path for this check; the value is now used. In addition to this, we will also check if a custom cache path was given for this check and cannot be written to but the default path can be, we'll gracefully fall back to the default (and warn the user of this).Clearing the cache store when disabling the cache should not result in a fatal error saving the global configuration. Wrap the
$cache->clean()call in try/catch blocks for theJCacheException*classes to handle these known errors (note this purposefully does not catch the parentRuntimeExceptionas try/catch blocks should generally be specific to known error conditions).Since we clear the cache store when disabling the cache, we should also do it when changing the handler. That is implemented now.
Testing Instructions
Saving the global config should still work no matter what.
Setting a value for the
cache_pathvar should result in that being the cache path used for the filesystem cache, when empty the code should not set the variable to the saved configuration. If this path can't be written to, the default path should be used instead and thecache_pathvalue not be saved.When changing cache handlers or disabling an active cache, the cache store should be cleaned. If the cache store can't be reached then a warning should be shown to the user and not block the save operation.
Documentation Changes Required
N/A