Yoast\WP\SEO\Actions\Importing\Aioseo

Aioseo_Validate_Data_Action::validate_aioseo_table()publicYoast 1.0

Validates the AIOSEO indexable table.

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

Хуков нет.

Возвращает

true|false. Whether the AIOSEO table exists and has the structure we expect.

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

$Aioseo_Validate_Data_Action = new Aioseo_Validate_Data_Action();
$Aioseo_Validate_Data_Action->validate_aioseo_table();

Код Aioseo_Validate_Data_Action::validate_aioseo_table() Yoast 22.3

public function validate_aioseo_table() {
	if ( ! $this->aioseo_helper->aioseo_exists() ) {
		return false;
	}

	$table       = $this->aioseo_helper->get_table();
	$needed_data = $this->post_importing_action->get_needed_data();

	$aioseo_columns = $this->wpdb->get_col(
		"SHOW COLUMNS FROM {$table}", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: There is no unescaped user input.
		0
	);

	return $needed_data === \array_intersect( $needed_data, $aioseo_columns );
}