WC_Notes_Run_Db_Update::note_up_to_date
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.
Returns
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() WC Notes Run Db Update::note up to date code WC 10.8.1
private static function note_up_to_date( $note, $update_url, $current_actions ) {
$actions = $note->get_actions();
return $note->get_id()
&& count( $current_actions ) === count( array_intersect( wp_list_pluck( $actions, 'name' ), $current_actions ) )
&& in_array( $update_url, wp_list_pluck( $actions, 'query' ), true );
}