User tests: Successful: Unsuccessful:
Pull Request for Issue #11490
Currently during component uninstallation, the Joomla uninstall adapter always deletes the categories of the component being uninstalled
(typically when going to reinstall the extension after uninstall it), because all data are kept but the categories are lost
Now during uninstalling the categories of the component can be kept if desired
(user choice to kept extension data)
At file script.php of you extension, inside method: uninstall(), add:
function uninstall($parent)
{
$parent->setUnInstallFlags(array('delete_cats'=>false));
// ... remaining code
}
Reinstall extension and confirm that categories have not been deleted
Category | ⇒ | Libraries |
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Title |
|
This is too error prone as an array.
i have made a fix if flag is not set
Also, this honestly should probably be deprecated out of the install adapter and made available as an action via JInstallerScript going forward.
yes , that will be better, who will code this ?
will this solution will be usable without waiting for J4 ?
will this solution will be usable without waiting for J4 ?
Yep, pretty simple. Add the method that's deleting the categories as a public method to JInstallerScript
, then for B/C purposes you check if the extension has provided a custom install script that is an instance of JInstallerScript
and call the new method from the install adapter otherwise you instantiate a new JInstallerScript
instance to run the delete categories code (with appropriate deprecation logging).
Ok, thanks
then i will close this PR and the issue should remain open for some time until a new more proper PR is made
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-08-06 14:43:12 |
Closed_By | ⇒ | ggppdk |
This is too error prone as an array. I can do
$installer->setUnInstallFlags([]);
and break this code far too easily. This doesn't need to be an array. Also, this honestly should probably be deprecated out of the install adapter and made available as an action viaJInstallerScript
going forward.