ActionScheduler_Abstract_Schema::tables_exist()publicWC 1.0

Confirms that all of the tables registered by this schema class have been created.

Method of the class: ActionScheduler_Abstract_Schema{}

No Hooks.

Return

true|false.

Usage

$ActionScheduler_Abstract_Schema = new ActionScheduler_Abstract_Schema();
$ActionScheduler_Abstract_Schema->tables_exist();

ActionScheduler_Abstract_Schema::tables_exist() code WC 9.3.1

public function tables_exist() {
	global $wpdb;

	$tables_exist = true;

	foreach ( $this->tables as $table_name ) {
		$table_name     = $wpdb->prefix . $table_name;
		$pattern        = str_replace( '_', '\\_', $table_name );
		$existing_table = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $pattern ) );

		if ( $existing_table !== $table_name ) {
			$tables_exist = false;
			break;
		}
	}

	return $tables_exist;
}