WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Notes_Run_Db_Update::update_needed_notice() private WC 1.0

Create and set up the first (out of 3) 'Database update needed' notice and store it in the database.

If a $note_id is given, the method updates the note instead of creating a new one.

Это метод класса: WC_Notes_Run_Db_Update{}

Хуков нет.

Возвращает

Число. Created/Updated note id

Использование

$result = WC_Notes_Run_Db_Update::update_needed_notice( $note_id );
$note_id(числоeger)
Note db record to update.
По умолчанию: null

Код WC_Notes_Run_Db_Update::update_needed_notice() WC 4.5.2

woocommerce/includes/admin/notes/class-wc-notes-run-db-update.php
<?php
private static function update_needed_notice( $note_id = null ) {
	$update_url = html_entity_decode(
		wp_nonce_url(
			add_query_arg( 'do_update_woocommerce', 'true', wc_get_current_admin_url() ? wc_get_current_admin_url() : admin_url( 'admin.php?page=wc-settings' ) ),
			'wc_db_update',
			'wc_db_update_nonce'
		)
	);

	$note_actions = array(
		array(
			'name'    => 'update-db_run',
			'label'   => __( 'Update WooCommerce Database', 'woocommerce' ),
			'url'     => $update_url,
			'status'  => 'unactioned',
			'primary' => true,
		),
		array(
			'name'    => 'update-db_learn-more',
			'label'   => __( 'Learn more about updates', 'woocommerce' ),
			'url'     => 'https://docs.woocommerce.com/document/how-to-update-woocommerce/',
			'status'  => 'unactioned',
			'primary' => false,
		),
	);

	if ( $note_id ) {
		$note = new WC_Admin_Note( $note_id );
	} else {
		$note = new WC_Admin_Note();
	}

	// Check if the note needs to be updated (e.g. expired nonce or different note type stored in the previous run).
	if ( self::note_up_to_date( $note, $update_url, wp_list_pluck( $note_actions, 'name' ) ) ) {
		return $note_id;
	}

	$note->set_title( __( 'WooCommerce database update required', 'woocommerce' ) );
	$note->set_content(
		__( 'WooCommerce has been updated! To keep things running smoothly, we have to update your database to the newest version.', 'woocommerce' )
		/* translators: %1$s: opening <a> tag %2$s: closing </a> tag*/
		. sprintf( ' ' . esc_html__( 'The database update process runs in the background and may take a little while, so please be patient. Advanced users can alternatively update via %1$sWP CLI%2$s.', 'woocommerce' ), '<a href="https://github.com/woocommerce/woocommerce/wiki/Upgrading-the-database-using-WP-CLI">', '</a>' )
	);
	$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_UPDATE );
	$note->set_name( self::NOTE_NAME );
	$note->set_content_data( (object) array() );
	$note->set_source( 'woocommerce-core' );
	// In case db version is out of sync with WC version or during the next update, the notice needs to show up again,
	// so set it to unactioned.
	$note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_UNACTIONED );

	// Set new actions.
	$note->clear_actions();
	foreach ( $note_actions as $note_action ) {
		$note->add_action( ...array_values( $note_action ) );
	}

	return $note->save();
}