Yoast\WP\SEO\Commands

Index_Command::run_indexation_action()protectedYoast 1.0

Runs an indexation action.

Метод класса: Index_Command{}

Хуков нет.

Возвращает

null. Ничего (null).

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->run_indexation_action( $name, $indexation_action, $interval );
$name(строка) (обязательный)
The name of the object to be indexed.
$indexation_action(Indexation_Action_Interface) (обязательный)
The indexation action.
$interval(int) (обязательный)
Number of microseconds (millionths of a second) to wait between index actions.

Код Index_Command::run_indexation_action() Yoast 22.4

protected function run_indexation_action( $name, Indexation_Action_Interface $indexation_action, $interval ) {
	$total = $indexation_action->get_total_unindexed();
	if ( $total > 0 ) {
		$limit    = $indexation_action->get_limit();
		$progress = Utils\make_progress_bar( 'Indexing ' . $name, $total );
		do {
			$indexables = $indexation_action->index();
			$count      = \count( $indexables );
			$progress->tick( $count );
			\usleep( $interval );
			Utils\wp_clear_object_cache();
		} while ( $count >= $limit );
		$progress->finish();
	}
}