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

Updates to delay functionality #39

Merged
merged 9 commits into from
Jul 25, 2024
Merged

Updates to delay functionality #39

merged 9 commits into from
Jul 25, 2024

Conversation

ecairol
Copy link
Contributor

@ecairol ecairol commented Jul 23, 2024

There are multiple plugins that are staying in the Auto-updates Disabled bucket. Reported for Brodo but is happening in other sites as well.

Changes in this Pull Request:

  • In case of NULL, no-slug is changed to an empty string. Useful to validate later with empty()
  • Because the slug could be empty, it was replaced with the plugin name in two places:
    • The database object that keeps track of everything.
    • The function get_installed_plugin_version which previously used slug in combination of dirname to get the version.
    • An example of name is woocommerce/woocommerce.php. This value is never an empty string or NULL.
  • The function get_plugins() is executed only once when the class loads, and store and re-use it as an object property
  • When calculating has_delay_passed(), if the slug is empty we will not be able to call Dotorg API. I saw plugins with empty slug stored both in GitHub and SVN/Trac, some with a changelog.txt and others didn't have explicit release versions, so I suspect it's nearly impossible to account for all of them. The safest case, IMO, is returning true for these cases where the slug is null.
  • Similarly, if the current version is the last one, also return true
  • The option_name was updated from plugin_update_delay to plugin_update_delay_2, to make sure we start from scratch (especially since we are now using plugin name instead of slug).

Test

These changes were tested in Brodo Dev, and the number under Auto-updates Disabled is now 3, all justified.
https://brodo-development-1712936759.mystagingwebsite.com/wp-admin/plugins.php

Screenshot 2024-07-23 at 5 03 06 PM

GitHub Issue:
https://github.com/a8cteam51/team51-dev-requests/issues/4479

@ecairol ecairol requested a review from ahegyes July 23, 2024 23:08
@ahegyes ahegyes merged commit 923a3cc into trunk Jul 25, 2024
@ahegyes ahegyes deleted the fix/update-delay branch July 25, 2024 09:34
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.

2 participants