Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't delete the extension's settings when uninstalling it #13526

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

julioccguimaraes
Copy link

@pemaier
Copy link
Contributor

pemaier commented Jan 12, 2024

Should this not be a decision of the extension developer of the extension? how you like to update an extension if you are loosing all previous information? what is the concept for this?

@stalker780
Copy link
Contributor

@pemaier that's what this PR is intended to do. To keep modules/extension settings when uninstalling an extension.

@pemaier
Copy link
Contributor

pemaier commented Jan 12, 2024

I see the problem from both sides. On the one side we need information for updates or a concept for it. On the other side do we get a setting table full of garbage. I think the problem is not that simple ... but in the end the decision should be at developer side.

@condor2
Copy link
Contributor

condor2 commented Jan 12, 2024

Much better to improve Uninstall function to ask if you want to delete settings or not for a module...

@julioccguimaraes
Copy link
Author

This change is temporary until the functionality to update an extension is added. I support my modules and every time I have to update them it's a routine of having to reconfigure them again and it costs me time and is tedious.

@stalker780
Copy link
Contributor

At least you still can uninstall modules and then uninstall extension. This will clear DB from garbage.

I agree there should be more clear process of extensions management.

For example there should be 2 buttons in extensions list:
1 - delete (which only deletes extension files for future update)
2 - uninstall (which deletes files + clears DB settings)

@danielkerr
Copy link
Member

what aboutt if ur doing an update and dont want the settings removed

@haxcop
Copy link

haxcop commented Feb 24, 2024

I've been using a sql trigger to accomplish such functionality, would be a good idea to get it implemented by default in opencart.
This will also works when you update the extension and remove the orphans left after every install/update
I also noticed I probably need to check into the settings to delete the row associated with it. but anyway, this runs just fine in the case of the ocmods


DELIMITER %%
DROP TRIGGER IF EXISTS `delete_unused_extensions`;
DELIMITER $$
CREATE TRIGGER `delete_unused_extensions` AFTER INSERT ON `oc_modification`
 FOR EACH ROW BEGIN
    DELETE FROM ocok_extension_install
    WHERE NOT EXISTS (
      SELECT 1
      FROM oc_modification
      WHERE extension_install_id = oc_extension_install.extension_install_id
    );
    
    DELETE FROM oc_extension_path
    WHERE NOT EXISTS (
      SELECT 1
      FROM oc_modification
      WHERE extension_install_id = oc_extension_path.extension_install_id
    );
END

@danielkerr
Copy link
Member

No mate

@stalker780
Copy link
Contributor

what aboutt if ur doing an update and dont want the settings removed

As far as I recall you cannot install extension with same code untill you uninstall an old one.
So it is not possible to update an extension without deleting it's settings.
This could have changed. Did not check this functionality for while.

@danielkerr
Copy link
Member

danielkerr commented Feb 26, 2024

i need to alter the system so we have install, update and uninstall

install creates tables
upgrade modifies tables if required and replaces files
uninstall removes settings and files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants