Minor: Fix misleading doc-comment and argument name.

Previously, triggerUpdateCheckOnce() was attached to a transient filter, but that's no longer the case. Now it's passed directly to WP_CLI::add_hook().

However, it still takes and returns a value. WP-CLI documentation says that the `before_invoke:<command>` hook takes one argument and acts as a filter.
This commit is contained in:
Yahnis Elsts 2024-02-02 16:07:07 +02:00
parent 36efab0022
commit a1445bb8dc

View file

@ -65,23 +65,20 @@ class WpCliCheckTrigger {
/**
* Trigger a potential update check once.
*
* The update transient can be read multiple times during a single WP-CLI command execution.
* For performance, we only want to trigger an update check once.
*
* @param mixed $transient
* @param mixed $input
* @return mixed The input value, unchanged.
* @internal This method is public so that it can be used as a WP-CLI hook callback.
* It should not be called directly.
*
*/
public function triggerUpdateCheckOnce($transient) {
public function triggerUpdateCheckOnce($input = null) {
if ( $this->wasCheckTriggered ) {
return $transient;
return $input;
}

$this->wasCheckTriggered = true;
$this->scheduler->maybeCheckForUpdates();

return $transient;
return $input;
}
}