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
1 changed files with 4 additions and 7 deletions

View File

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