WC_Notes_Run_Db_Update::note_up_to_date()private staticWC 1.0

Check whether the note is up to date for a fresh display.

The check tests if

  • actions are set up for the first 'Update database' notice, and
  • URL for note's action is equal to the given URL (to check for potential nonce update).

Method of the class: WC_Notes_Run_Db_Update{}

No Hooks.

Return

true|false.

Usage

$result = WC_Notes_Run_Db_Update::note_up_to_date( $note, $update_url, $current_actions );
$note(Note) (required)
Note to check.
$update_url(string) (required)
URL to check the note against.
$current_actions (required)
-

WC_Notes_Run_Db_Update::note_up_to_date() code WC 8.7.0

private static function note_up_to_date( $note, $update_url, $current_actions ) {
	$actions = $note->get_actions();
	return count( $current_actions ) === count( array_intersect( wp_list_pluck( $actions, 'name' ), $current_actions ) )
		&& in_array( $update_url, wp_list_pluck( $actions, 'query' ), true );
}