Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Deleting theme doesn't remove auto-update preference #30

Closed
bookdude13 opened this issue Mar 25, 2020 · 4 comments · Fixed by #132
Closed

Deleting theme doesn't remove auto-update preference #30

bookdude13 opened this issue Mar 25, 2020 · 4 comments · Fixed by #132
Labels
Core Merge Prerequisite This code that will require an update before merging to core

Comments

@bookdude13
Copy link
Contributor

This is the same as in audrasjb/wp-autoupdates#29, but with themes on single site. We need the hook from https://core.trac.wordpress.org/ticket/14955 before we can do this.

@pbiron pbiron added the Core Merge Prerequisite This code that will require an update before merging to core label Mar 30, 2020
@azaozz
Copy link
Contributor

azaozz commented May 1, 2020

Thinking that not removing the autoupdate setting on deleting a theme or plugin is the proper way here. Themes and plugins may be deleted as part of trying to fix some issue, then they are immediately reinstalled. Removing/resetting the autoupdate option wouldn't be a good idea in these cases.

IMHO it would be better to "reset/clean up" the autoupdate array each time a theme or plugin is added or removed.

@pbiron
Copy link
Contributor

pbiron commented May 1, 2020

Thinking that not removing the autoupdate setting on deleting a theme or plugin is the proper way here. Themes and plugins may be deleted as part of trying to fix some issue, then they are immediately reinstalled. Removing/resetting the autoupdate option wouldn't be a good idea in these cases.

That's a good point; although I can see the site option getting very big without it.

IMHO it would be better to "reset/clean up" the autoupdate array each time a theme or plugin is added or removed.

That's already done in a number of places, I'll double check that it's done everywhere it should be.

@azaozz
Copy link
Contributor

azaozz commented May 1, 2020

I can see the site option getting very bug without it

Not necessarily. Example: site with 50 plugins; deleting 10 plugins will leave the autoupdates array as-is, lets say 30 elements. Installing 5 new plugins will not update the array, still 30. Then the first time the autoupdate setting is changed, the array will be reset. It will never go over the max number of installed plugins.

That's already done

Yeah, this already happens as far as I see.

@knutsp
Copy link
Contributor

knutsp commented May 2, 2020

Cleaning the array when a setting is changed seems to be the best. A test should ensure the settings array only contains installed plugins after a change.

This will then work (preserve the setting), as long av user does not change any such setting between deleting and reinstallling a (set of) theme/plugin(s).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core Merge Prerequisite This code that will require an update before merging to core
Projects
None yet
4 participants