Skip to content

Fix "Perform all updates" task was incorrectly marked as completed #534

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

Merged
merged 3 commits into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
= 1.7.0 =

Bugs we fixed:

* Fix issue where "Perform all updates" task was incorrectly marked as completed.


= 1.6.1 =

Bugs we fixed:
Expand Down
2 changes: 1 addition & 1 deletion classes/class-suggested-tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct() {
$this->tasks_manager = new Tasks_Manager();

if ( \is_admin() ) {
\add_action( 'init', [ $this, 'init' ], 100 ); // Wait for the post types to be initialized.
\add_action( 'admin_init', [ $this, 'init' ], 20 ); // Wait for the post types to be initialized and transients to be set.

// Check GET parameter and maybe set task as pending.
\add_action( 'init', [ $this, 'maybe_complete_task' ] );
Expand Down
13 changes: 13 additions & 0 deletions classes/suggested-tasks/providers/class-core-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ public function should_add_task() {
if ( ! \function_exists( 'get_core_updates' ) ) {
require_once ABSPATH . 'wp-admin/includes/update.php'; // @phpstan-ignore requireOnce.fileNotFound
}

// For wp_get_update_data() to return correct data it needs to be called after the 'admin_init' action (with priority 10).
return 0 < \wp_get_update_data()['counts']['total'];
}

/**
* Check if the task is completed.
*
* @param string $task_id The task ID.
*
* @return bool
*/
public function is_task_completed( $task_id = '' ) {
return \wp_doing_ajax() ? false : ! $this->should_add_task();
}
}
Loading