? Success

User tests: Successful: Unsuccessful:

avatar Jiwoks
Jiwoks
21 Nov 2016

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.

Steps to reproduce the issue

On a fresh install

  • Download the test component attached
  • In global configuration page, activate progressive or conservative cache
  • Install the given test component (com_test), result from component helper is the same than database
  • Uninstall the installed component (com_test)
  • Install the given component again, result from component helper differs from what's actually in database

Expected result

Result from component helper and database should be the same

Actual result

After the second install the result from component helper differs from what's actually in database

Test PR

  • Apply pull request
  • Uninstall and reinstall the com_test extension
  • The result from component helper and database should now be the same

System information (as much as possible)

  • Joomla latest version
  • Conservative or progressive cache enabled

Additional comments

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

com_test.zip

avatar Jiwoks Jiwoks - open - 21 Nov 2016
avatar Jiwoks Jiwoks - change - 21 Nov 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 Nov 2016
Category Administration com_installer
avatar mbabker
mbabker - comment - 21 Nov 2016

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.

avatar ggppdk
ggppdk - comment - 21 Nov 2016

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

avatar Jiwoks
Jiwoks - comment - 22 Nov 2016

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.

avatar mbabker
mbabker - comment - 22 Nov 2016

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.

avatar mbabker
mbabker - comment - 21 May 2017

This PR is out of sync and #15606 is a more complete solution. Closing.

avatar mbabker mbabker - change - 21 May 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-05-21 23:52:03
Closed_By mbabker
avatar mbabker mbabker - close - 21 May 2017

Add a Comment

Login with GitHub to post a comment