? Failure

User tests: Successful: Unsuccessful:

avatar ggppdk
ggppdk
6 Aug 2016

Pull Request for Issue #11490

Summary of Changes

Currently during component uninstallation, the Joomla uninstall adapter always deletes the categories of the component being uninstalled

  • this is a problem when component gives option to the user to keep the extension's data

(typically when going to reinstall the extension after uninstall it), because all data are kept but the categories are lost

Testing Instructions

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

avatar joomla-cms-bot joomla-cms-bot - change - 6 Aug 2016
Category Libraries
avatar ggppdk ggppdk - open - 6 Aug 2016
avatar ggppdk ggppdk - change - 6 Aug 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Aug 2016
Labels Added: ?
avatar ggppdk ggppdk - change - 6 Aug 2016
Title
Allow uninstall() method of script.php to decide keeping component ca
Allow uninstall() method of script.php to decide keeping component categories
avatar ggppdk ggppdk - edited - 6 Aug 2016
avatar ggppdk ggppdk - edited - 6 Aug 2016
avatar ggppdk ggppdk - change - 6 Aug 2016
The description was changed
avatar ggppdk ggppdk - edited - 6 Aug 2016
avatar mbabker
mbabker - comment - 6 Aug 2016

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 via JInstallerScript going forward.

avatar ggppdk
ggppdk - comment - 6 Aug 2016

@mbabker

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 ?

avatar mbabker
mbabker - comment - 6 Aug 2016

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).

avatar ggppdk
ggppdk - comment - 6 Aug 2016

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

avatar ggppdk ggppdk - close - 6 Aug 2016
avatar ggppdk ggppdk - change - 6 Aug 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-08-06 14:43:12
Closed_By ggppdk

Add a Comment

Login with GitHub to post a comment