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

Plugin/theme auto-update improvements #97

Merged
merged 10 commits into from
May 24, 2021

Conversation

desrosj
Copy link
Contributor

@desrosj desrosj commented May 7, 2021

Proposed changes

The plugin includes an option to blanket enable or disable auto-updates for plugins and/or themes. When either option is disabled, the user is able to manage auto-update settings on an individual basis using the default interface in WordPress Core introduced in version 5.5.

This works great when the plugin is active, but if the plugin is deactivated or removed, plugin/theme auto-updates are also wholesale turned off and the corresponding settings in Bluerock have no affect (they currently update the option key specific to this plugin and not the default WordPress Core option).

This updates the logic in the plugin to update the default WordPress Core auto-update settings for plugins and themes any time:

  • a plugin or theme is installed, deleted, or updated.
  • the plugin or theme auto-update setting is toggled.

When either of those two settings are toggled off, the Core option is not updated. This ensures all plugins and themes continue to receive auto-updates unless the user explicitly disables them on the plugin or theme page.

Bluerock and the installer scripts will soon be updated to also sync the default WordPress Core options to ensure auto-updates are appropriately applied even when the Bluehost plugin is disabled or removed.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

desrosj added 3 commits May 6, 2021 15:13
Because the `true` and `default` conditions are the same, we can omit the one for `true` and allow the `default` to handle the scenario.
…options.

The plugin includes an option to blanket enable or disable auto-updates for plugins and/or themes. When either option is disabled, the user is able to manage auto-update settings on an individual basis using the default interface in WordPress Core introduced in version 5.5.

This works great when the plugin is active, but if the plugin is deactivated or removed, plugin/theme auto-updates are also wholesale turned off and the corresponding settings in Bluerock have no affect (they currently update the option key specific to this plugin and not the default WordPress Core option).

This updates the logic in the plugin to update the default WordPress Core auto-update settings for plugins and themes any time:

- a plugin or theme is installed, deleted, or updated.
- the plugin or theme auto-update setting is toggled.

When either of those two settings are toggled off, the Core option is not updated. This ensures all plugins and themes continue to receive auto-updates unless the user explicitly disables them on the plugin or theme page.

Bluerock and the installer scripts will soon be updated to also sync the default WordPress Core options to ensure auto-updates are appropriately applied even when the Bluehost plugin is disabled or removed.
inc/updates.php Show resolved Hide resolved
@desrosj desrosj self-assigned this May 7, 2021
@desrosj
Copy link
Contributor Author

desrosj commented May 7, 2021

I added a comment to one of the functions I wanted to collect thoughts so it can get discussed in context.

Another thing that is still missing from this is an upgrade routine for when the next version of the plugin is released.

I have not tested it, but it's possible that the plugin list will get updated automatically. The plugin would be installed with a plugin update, so it may fire the upgrader_process_complete hook. It's also possible the action would fire without loading the plugin (it gets disabled before updating), or with the old version of the plugin in memory (without the registered action hook in the new version).

Regardless, the theme list would not be updated. If we want both options to be updated when the new plugin version is installed, there are two options:

  • Update both Core options when the plugin updates to ensure they contain the right values. If the very next action after the plugin updates is the site owner deactivating the plugin, all plugins and themes would continue auto-updating until they are disabled manually.
  • Let the options populate organically whenever the next plugin and theme are installed, deleted, or updated (if we choose to leave the question I posed above as is and sync the option on updates).

@desrosj desrosj changed the title Plugin theme auto update improvements Plugin theme auto-update improvements May 7, 2021
@desrosj desrosj changed the title Plugin theme auto-update improvements Plugin/theme auto-update improvements May 7, 2021
@desrosj desrosj added bug Something isn't working enhancement New feature or request labels May 7, 2021
@desrosj
Copy link
Contributor Author

desrosj commented May 10, 2021

Returning to this after the weekend, it seems to make the most sense to just update the options on update. There are only 2, and it's not an intensive update, so making sure the Core and plugin options are in sync is best.

I added an update routing assuming we would release this in a version 2.7.0.

@0aveRyan 0aveRyan merged commit a9a80fe into master May 24, 2021
@0aveRyan 0aveRyan deleted the plugin-theme-auto-update-improvements branch May 27, 2021 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants