{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/12958","repository_url":"https://api.github.com/repos/joomla/joomla-cms","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/12958/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/12958/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/12958/events","html_url":"https://github.com/joomla/joomla-cms/pull/12958","id":190752609,"number":12958,"title":"cache not cleared after extension uninstall in com_installer","user":{"login":"Jiwoks","id":3033071,"avatar_url":"https://avatars.githubusercontent.com/u/3033071?v=3","gravatar_id":"","url":"https://api.github.com/users/Jiwoks","html_url":"https://github.com/Jiwoks","followers_url":"https://api.github.com/users/Jiwoks/followers","following_url":"https://api.github.com/users/Jiwoks/following{/other_user}","gists_url":"https://api.github.com/users/Jiwoks/gists{/gist_id}","starred_url":"https://api.github.com/users/Jiwoks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jiwoks/subscriptions","organizations_url":"https://api.github.com/users/Jiwoks/orgs","repos_url":"https://api.github.com/users/Jiwoks/repos","events_url":"https://api.github.com/users/Jiwoks/events{/privacy}","received_events_url":"https://api.github.com/users/Jiwoks/received_events","type":"User","site_admin":false},"labels":[{"id":60721348,"url":"https://api.github.com/repos/joomla/joomla-cms/labels/PR-staging","name":"PR-staging","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-21T15:40:21Z","updated_at":"2016-11-22T10:39:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/12958","html_url":"https://github.com/joomla/joomla-cms/pull/12958","diff_url":"https://github.com/joomla/joomla-cms/pull/12958.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/12958.patch"},"body":"After uninstalling an extension the system cache is not cleared\r\nAs 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.\r\n\r\n### Steps to reproduce the issue\r\nOn a fresh install\r\n* Download the test component attached\r\n* In global configuration page, activate progressive or conservative cache\r\n* Install the given test component (com_test), result from component helper is the same than database\r\n* Uninstall the installed component (com_test)\r\n* Install the given component again, result from component helper differs from what's actually in database\r\n\r\n\r\n### Expected result\r\nResult from component helper and database should be the same\r\n\r\n\r\n### Actual result\r\nAfter the second install the result from component helper differs from what's actually in database\r\n\r\n\r\n### Test PR\r\n* Apply pull request \r\n* Uninstall and reinstall the com_test extension\r\n* The result from component helper and database should now be the same\r\n\r\n### System information (as much as possible)\r\n* Joomla latest version\r\n* Conservative or progressive cache enabled\r\n\r\n\r\n### Additional comments\r\ncom_test will print echo in the install script the result of component helper and database queries to get com_test id in #__extensions table\r\nThere is also a component menu entry where the issue can also be verified\r\n\r\n[com_test.zip](https://github.com/joomla/joomla-cms/files/604026/com_test.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/262206408","html_url":"https://github.com/joomla/joomla-cms/pull/12958#issuecomment-262206408","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/12958","id":262206408,"user":{"login":"Jiwoks","id":3033071,"avatar_url":"https://avatars.githubusercontent.com/u/3033071?v=3","gravatar_id":"","url":"https://api.github.com/users/Jiwoks","html_url":"https://github.com/Jiwoks","followers_url":"https://api.github.com/users/Jiwoks/followers","following_url":"https://api.github.com/users/Jiwoks/following{/other_user}","gists_url":"https://api.github.com/users/Jiwoks/gists{/gist_id}","starred_url":"https://api.github.com/users/Jiwoks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jiwoks/subscriptions","organizations_url":"https://api.github.com/users/Jiwoks/orgs","repos_url":"https://api.github.com/users/Jiwoks/repos","events_url":"https://api.github.com/users/Jiwoks/events{/privacy}","received_events_url":"https://api.github.com/users/Jiwoks/received_events","type":"User","site_admin":false},"created_at":"2016-11-22T10:39:32Z","updated_at":"2016-11-22T10:39:32Z","body":"That's right frontend is also affected by this issue and must be cleared too.\r\n\r\nI 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.\r\n\r\nI think that cache must be cleared on :\r\n* Extension uninstallation : remove method (https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_installer/models/manage.php#L189)\r\nMaybe it would even be better to clear the cache after each uninstallation (https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_installer/models/manage.php#L249) in case any other extension need to access the up to date JComponentHelper::getComponent method during uninstallation script.\r\n* Publishing / Depublishing extension : publish method (https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_installer/models/manage.php#L88) \r\nAlso here maybe it should be done in the loop (https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_installer/models/manage.php#L145)\r\n* Updating an extension : install method (https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_installer/models/update.php#L385)\r\n\r\nAlso it would be better to use the JModelLegacy::cleanCache method to clear both cache to avoid redundant code."}}
{"actor":{"display_login":"Jiwoks"}}