It's possible to set a custom cache path in configuration.php
public $cache_path = '/absolute/path/to/custom/cache2345';
On the other hand includes/defines.php and administrator/includes/defines.php are defining a constant
=> Use $cache_path for FE and also BE if defined. If not uses JPATH_CACHE (depends on BE or FE).
=> Use $cache_path if defined only for FE. Otherwise /path/to/joomla/cache/.
=> Use always /path/to/joomla/administrator/cache/ for BE.
=> Uses JPATH_CACHE. Ignores $cache_path completely. (Seems to be a bug. I will provide a PR.).
This all may lead to unwanted and/or confusing results if you use Cache Handler File which is the mostly used one.
I wanted to correct cache directories output of tab Folder Permissions
administrator/index.php?option=com_admin&view=sysinfo
because if you define $cache_path in configuration.php it only shows 1 path instead of 2 paths (1 for BE, 1 for FE which is definitely(?) correct meanwhile.)
Because I would like to do a code review concerning cache paths I have this question now:
and
I can see the use case for a custom cache path. Putting cache files in a ramdisk or something like that.
Category | ⇒ | Cache |
Labels |
Added:
?
Removed: ? |
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-08-12 19:25:14 |
Closed_By | ⇒ | bertmert |
IMO
JPATH_CACHE
should ALWAYS equate toJPATH_ADMINISTRATOR . '/cache'
, I personally don't see the need for separate filesystem cache per application especially since some of the stuff caching data is shared between applications, and I'd say the less top level directories Joomla requires in the web root the better.And IMO any place looking for a filesystem cache path should be doing
JFactory::getConfig()->get('cache_path', JPATH_CACHE);
as that allows a custom cache path to be defined (outside the web root if you're insistent on that) while still uses a reasonable default. So the config var shouldn't be deprecated.Unless you've screwed up your application bootstrap (thinking custom CLI or web apps now, not the default CMS app classes or
index.php
front controllers), you'll always have theJPATH_*
constants andJFactory::getConfig()
working to get these values, not to mention you can inject custom values calling the factory methods directly instead of going throughJFactory
or using the public APIs to change some values. So I don't think there's any action needed regarding changing how these values are used.