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

Update yahnis-elsts/plugin-update-checker from 4.13 to 5.1 #555

Merged
merged 3 commits into from
Aug 18, 2023

Conversation

dkotter
Copy link
Collaborator

@dkotter dkotter commented Aug 4, 2023

Description of the Change

The Plugin Update Checker library we use is also used on a few other 10up projects. We need to ensure we are using the same version across all of these or you can end up with conflicts (especially when using composer to manage all dependencies of a project). This PR updates this library to the latest version, which will also be done in other repos that are using this library.

How to test the Change

  1. Pull these changes down
  2. Within the classifai.php file, set the version number to something lower, like 2.1.0
  3. Ensure you have a proper license in place
  4. Go to the plugins section and ensure you see an update notice for Classifai (may need to click the Check for updates link; also ensure the plugin is active)
  5. Click on the View version X.X.X details link and ensure you see proper details
  6. Go to the WordPress Updates page and ensure you see Classifai there as well, with the icon
  7. Click on the View version X.X.X details link and ensure you see proper details
  8. If desired, click the update now link and ensure an update works (either from the plugins page or the main updates page). Note though that this will wipe out your version controlled classifai directory, so proceed with caution

Changelog Entry

Changed - Upgrade the Plugin Update Checker library to 5.1

Credits

Props @dkotter

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@dkotter dkotter requested review from jeffpaul and a team as code owners August 4, 2023 15:12
@dkotter dkotter self-assigned this Aug 4, 2023
@dkotter dkotter requested review from a team and Sidsector9 and removed request for a team and jeffpaul August 4, 2023 15:12
@dkotter dkotter added this to the 2.3.0 milestone Aug 4, 2023
@Sidsector9
Copy link
Member

I'm having a bit trouble reproducing step (4). I'll investigate it tomorrow.

@dkotter
Copy link
Collaborator Author

dkotter commented Aug 7, 2023

I'm having a bit trouble reproducing step (4). I'll investigate it tomorrow.

If you're on multisite, you'll need to go to the network plugins screen to see updates (this caught me when testing). If you have caching in place, that may also play a role and will need to be flushed

@dkotter dkotter requested a review from ravinderk August 7, 2023 22:22
@ravinderk
Copy link
Contributor

I'm having a bit of trouble reproducing step (4). I'll investigate it tomorrow.

@Sidsector9 I also face the same issue. I resolved it by re-installing composer packages and node packages.

Copy link
Contributor

@ravinderk ravinderk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkotter It is working as expected.

image image image

Copy link
Contributor

@ravinderk ravinderk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkotter I noticed the following error in debug.log. Can you check?

[08-Aug-2023 06:50:09 UTC] PHP Notice:  Trying to get property 'filename' of non-object in /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-content/plugins/classifai/includes/Classifai/Admin/Update.php on line 91
[08-Aug-2023 06:50:09 UTC] PHP Stack trace:
[08-Aug-2023 06:50:09 UTC] PHP   1. {main}() /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-admin/update-core.php:0
[08-Aug-2023 06:50:09 UTC] PHP   2. require_once() /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-admin/update-core.php:10
[08-Aug-2023 06:50:09 UTC] PHP   3. do_action($hook_name = 'load-update-core.php') /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-admin/admin.php:385
[08-Aug-2023 06:50:09 UTC] PHP   4. WP_Hook->do_action($args = [0 => '']) /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-includes/plugin.php:517
[08-Aug-2023 06:50:09 UTC] PHP   5. WP_Hook->apply_filters($value = '', $args = [0 => '']) /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-includes/class-wp-hook.php:334
[08-Aug-2023 06:50:09 UTC] PHP   6. wp_update_plugins($extra_stats = '') /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-includes/class-wp-hook.php:310
[08-Aug-2023 06:50:09 UTC] PHP   7. set_site_transient($transient = 'update_plugins', $value = class stdClass { public $last_checked = 1691477409; public $response = ['autoshare-for-twitter/autoshare-for-twitter.php' => class stdClass { ... }, 'custom-post-type-ui/custom-post-type-ui.php' => class stdClass { ... }, 'polylang/polylang.php' => class stdClass { ... }]; public $translations = []; public $no_update = ['akismet/akismet.php' => class stdClass { ... }, 'classic-editor/classic-editor.php' => class stdClass { ... }, 'insert-special-characters/insert-special-characters.php' => class stdClass { ... }, 'loco-translate/loco.php' => class stdClass { ... }, 'safe-redirect-manager/safe-redirect-manager.php' => class stdClass { ... }, 'safe-svg/safe-svg.php' => class stdClass { ... }, 'simple-page-ordering/simple-page-ordering.php' => class stdClass { ... }, 'classifai/classifai.php' => class stdClass { ... }]; public $checked = ['10up-sitemaps/10up-sitemaps.php' => '1.2', 'akismet/akismet.php' => '5.2', 'autoshare-for-twitter/autoshare-for-twitter.php' => '2.0.0', 'classic-editor/classic-editor.php' => '1.6.3', 'classifai/classifai.php' => '2.3.0-dev', 'custom-post-type-ui/custom-post-type-ui.php' => '1.13.5', 'distributor/distributor.php' => '2.0.0-rc1', 'auto-distribute/auto-distribute.php' => '0.2.0', 'distributor-edit-remote-post-meta/plugin.php' => '0.2.1', 'insert-special-characters/insert-special-characters.php' => '1.0.7', 'loco-translate/loco.php' => '2.6.4', 'mention-notifier/plugin.php' => '0.1.0', 'polylang/polylang.php' => '3.3.3', 'safe-redirect-manager/safe-redirect-manager.php' => '2.0.1', 'safe-svg/safe-svg.php' => '2.1.1', 'simple-page-ordering/simple-page-ordering.php' => '2.5.1', 'speedyseo/speedyseo.php' => '0.2.0'] }, $expiration = *uninitialized*) /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-includes/update.php:393
[08-Aug-2023 06:50:09 UTC] PHP   8. apply_filters($hook_name = 'pre_set_site_transient_update_plugins', $value = class stdClass { public $last_checked = 1691477409; public $response = ['autoshare-for-twitter/autoshare-for-twitter.php' => class stdClass { ... }, 'custom-post-type-ui/custom-post-type-ui.php' => class stdClass { ... }, 'polylang/polylang.php' => class stdClass { ... }]; public $translations = []; public $no_update = ['akismet/akismet.php' => class stdClass { ... }, 'classic-editor/classic-editor.php' => class stdClass { ... }, 'insert-special-characters/insert-special-characters.php' => class stdClass { ... }, 'loco-translate/loco.php' => class stdClass { ... }, 'safe-redirect-manager/safe-redirect-manager.php' => class stdClass { ... }, 'safe-svg/safe-svg.php' => class stdClass { ... }, 'simple-page-ordering/simple-page-ordering.php' => class stdClass { ... }, 'classifai/classifai.php' => class stdClass { ... }]; public $checked = ['10up-sitemaps/10up-sitemaps.php' => '1.2', 'akismet/akismet.php' => '5.2', 'autoshare-for-twitter/autoshare-for-twitter.php' => '2.0.0', 'classic-editor/classic-editor.php' => '1.6.3', 'classifai/classifai.php' => '2.3.0-dev', 'custom-post-type-ui/custom-post-type-ui.php' => '1.13.5', 'distributor/distributor.php' => '2.0.0-rc1', 'auto-distribute/auto-distribute.php' => '0.2.0', 'distributor-edit-remote-post-meta/plugin.php' => '0.2.1', 'insert-special-characters/insert-special-characters.php' => '1.0.7', 'loco-translate/loco.php' => '2.6.4', 'mention-notifier/plugin.php' => '0.1.0', 'polylang/polylang.php' => '3.3.3', 'safe-redirect-manager/safe-redirect-manager.php' => '2.0.1', 'safe-svg/safe-svg.php' => '2.1.1', 'simple-page-ordering/simple-page-ordering.php' => '2.5.1', 'speedyseo/speedyseo.php' => '0.2.0'] }, ...$args = variadic('update_plugins')) /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-includes/option.php:2053
[08-Aug-2023 06:50:09 UTC] PHP   9. WP_Hook->apply_filters($value = class stdClass { public $last_checked = 1691477409; public $response = ['autoshare-for-twitter/autoshare-for-twitter.php' => class stdClass { ... }, 'custom-post-type-ui/custom-post-type-ui.php' => class stdClass { ... }, 'polylang/polylang.php' => class stdClass { ... }]; public $translations = []; public $no_update = ['akismet/akismet.php' => class stdClass { ... }, 'classic-editor/classic-editor.php' => class stdClass { ... }, 'insert-special-characters/insert-special-characters.php' => class stdClass { ... }, 'loco-translate/loco.php' => class stdClass { ... }, 'safe-redirect-manager/safe-redirect-manager.php' => class stdClass { ... }, 'safe-svg/safe-svg.php' => class stdClass { ... }, 'simple-page-ordering/simple-page-ordering.php' => class stdClass { ... }, 'classifai/classifai.php' => class stdClass { ... }]; public $checked = ['10up-sitemaps/10up-sitemaps.php' => '1.2', 'akismet/akismet.php' => '5.2', 'autoshare-for-twitter/autoshare-for-twitter.php' => '2.0.0', 'classic-editor/classic-editor.php' => '1.6.3', 'classifai/classifai.php' => '2.3.0-dev', 'custom-post-type-ui/custom-post-type-ui.php' => '1.13.5', 'distributor/distributor.php' => '2.0.0-rc1', 'auto-distribute/auto-distribute.php' => '0.2.0', 'distributor-edit-remote-post-meta/plugin.php' => '0.2.1', 'insert-special-characters/insert-special-characters.php' => '1.0.7', 'loco-translate/loco.php' => '2.6.4', 'mention-notifier/plugin.php' => '0.1.0', 'polylang/polylang.php' => '3.3.3', 'safe-redirect-manager/safe-redirect-manager.php' => '2.0.1', 'safe-svg/safe-svg.php' => '2.1.1', 'simple-page-ordering/simple-page-ordering.php' => '2.5.1', 'speedyseo/speedyseo.php' => '0.2.0'] }, $args = [0 => class stdClass { public $last_checked = 1691477409; public $response = [...]; public $translations = [...]; public $no_update = [...]; public $checked = [...] }, 1 => 'update_plugins']) /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-includes/plugin.php:205
[08-Aug-2023 06:50:09 UTC] PHP  10. Classifai\Admin\Update->maybe_update($transient = class stdClass { public $last_checked = 1691477409; public $response = ['autoshare-for-twitter/autoshare-for-twitter.php' => class stdClass { ... }, 'custom-post-type-ui/custom-post-type-ui.php' => class stdClass { ... }, 'polylang/polylang.php' => class stdClass { ... }]; public $translations = []; public $no_update = ['akismet/akismet.php' => class stdClass { ... }, 'classic-editor/classic-editor.php' => class stdClass { ... }, 'insert-special-characters/insert-special-characters.php' => class stdClass { ... }, 'loco-translate/loco.php' => class stdClass { ... }, 'safe-redirect-manager/safe-redirect-manager.php' => class stdClass { ... }, 'safe-svg/safe-svg.php' => class stdClass { ... }, 'simple-page-ordering/simple-page-ordering.php' => class stdClass { ... }, 'classifai/classifai.php' => class stdClass { ... }]; public $checked = ['10up-sitemaps/10up-sitemaps.php' => '1.2', 'akismet/akismet.php' => '5.2', 'autoshare-for-twitter/autoshare-for-twitter.php' => '2.0.0', 'classic-editor/classic-editor.php' => '1.6.3', 'classifai/classifai.php' => '2.3.0-dev', 'custom-post-type-ui/custom-post-type-ui.php' => '1.13.5', 'distributor/distributor.php' => '2.0.0-rc1', 'auto-distribute/auto-distribute.php' => '0.2.0', 'distributor-edit-remote-post-meta/plugin.php' => '0.2.1', 'insert-special-characters/insert-special-characters.php' => '1.0.7', 'loco-translate/loco.php' => '2.6.4', 'mention-notifier/plugin.php' => '0.1.0', 'polylang/polylang.php' => '3.3.3', 'safe-redirect-manager/safe-redirect-manager.php' => '2.0.1', 'safe-svg/safe-svg.php' => '2.1.1', 'simple-page-ordering/simple-page-ordering.php' => '2.5.1', 'speedyseo/speedyseo.php' => '0.2.0'] }) /Users/ravinderkumar/Local-Sites/10osp/app/public/wp-includes/class-wp-hook.php:312


Step to reproduce

This issue only happens once when you switch from develop to feature/update-plugin-checker.

  • Switch to develop
  • Go to the WordPress Updates page.
  • Switch to feature/update-plugin-checker
  • Go to the WordPress Updates page.
  • Check debug.log

@dkotter
Copy link
Collaborator Author

dkotter commented Aug 17, 2023

@dkotter I noticed the following error in debug.log. Can you check?

I was able to reproduce this but couldn't figure out why it's happening. I added a check to resolve this issue though would be great to understand what changed to cause this. As far as I can tell, everything still works as expected so this may not be a big deal.

In addition, the method that was causing this error is the maybe_update method. I'm not sure this is even needed, as I removed this and things still seemed to work. In looking at the documentation for the update checker, I'm not even seeing this code referenced there so not quite sure why we're using it (seems it was copied from Distributor). But may be safer to just leave for now

@dkotter dkotter requested a review from ravinderk August 17, 2023 22:03
@dkotter dkotter mentioned this pull request Aug 17, 2023
17 tasks
@dkotter dkotter merged commit 5e545c1 into develop Aug 18, 2023
@dkotter dkotter deleted the feature/update-plugin-checker branch August 18, 2023 14:59
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.

3 participants