User tests: Successful: Unsuccessful:
After uninstalling an extension the system cache is not cleared
As the component helper class uses the cache system for database queries (https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/component/helper.php#L446) the usage of the method getComponent in this class after uninstalling an extension may not be relevant as it will use outdated cache datas.
On a fresh install
Result from component helper and database should be the same
After the second install the result from component helper differs from what's actually in database
com_test will print echo in the install script the result of component helper and database queries to get com_test id in #__extensions table
There is also a component menu entry where the issue can also be verified
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_installer |
all install and update routes should clear this cache group as well if they aren't already.
We had problems with cached component data, (e.g. getting previous extension id for the component and not the new one !) when users uninstalled our extension (component) and then immediately reinstalled it.
So we added clearing of '_system' group in script.php of our extension on both install / update
That's right frontend is also affected by this issue and must be cleared too.
I don't think install need to be cleared because as the component doesn't exist before and the cache would have been cleared during uninstallation process if the component has existed.
I think that cache must be cleared on :
Also it would be better to use the JModelLegacy::cleanCache method to clear both cache to avoid redundant code.
Clearing the cache only needs to be done once per operation, not in a loop. The first call to JComponentHelper::load()
and JPluginHelper::load()
result in the extension data being loaded into a static variable in those classes to avoid querying the database each time that data is called, so for the lifetime of that request, whatever is in the cache is what is used. And I don't believe we should add a way to reset that; we're getting into real edge cases if you need direct access to that data during the install cycles and even if you do you can issue the relevant query to load it in your extension's install script.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-21 23:52:03 |
Closed_By | ⇒ | mbabker |
This shouldn't just clear admin cache, frontend uses a different cache. Also, this shouldn't happen just on uninstall; all install and update routes should clear this cache group as well if they aren't already.