Yoast\WP\SEO\Repositories

Indexable_Cleanup_Repository::count_indexables_for_orphaned_users()publicYoast 1.0

Counts indexables for orphaned users.

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

Хуков нет.

Возвращает

Разное.

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

$Indexable_Cleanup_Repository = new Indexable_Cleanup_Repository();
$Indexable_Cleanup_Repository->count_indexables_for_orphaned_users();

Код Indexable_Cleanup_Repository::count_indexables_for_orphaned_users() Yoast 23.5

public function count_indexables_for_orphaned_users() {
	global $wpdb;
	$indexable_table = Model::get_table_name( 'Indexable' );
	$source_table    = $wpdb->users;
	//phpcs:disable WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: Already prepared.
	return $wpdb->get_col(
		"
		SELECT count(*)
		FROM {$indexable_table} indexable_table
		LEFT JOIN {$source_table} AS source_table
		ON indexable_table.object_id = source_table.ID
		WHERE source_table.ID IS NULL
		AND indexable_table.object_id IS NOT NULL
		AND indexable_table.object_type = 'user'"
	)[0];
	// phpcs:enable
}