Automator_DB::verify_base_tables( false $execute = false )

Validates if all Automator tables exists


Parameters Parameters

$execute

(false) (Optional)

Default value: false


Top ↑

Return Return

(array)


Source Source

File: src/core/class-automator-db.php

	public static function verify_base_tables( $execute = false ) {
		require_once ABSPATH . 'wp-admin/includes/upgrade.php';

		if ( $execute ) {
			self::create_tables();
			self::create_views();
		}
		$queries        = dbDelta( self::get_schema(), false );
		$missing_tables = array();
		foreach ( $queries as $table_name => $result ) {
			if ( "Created table $table_name" === $result ) {
				$missing_tables[] = $table_name;
			}
		}

		if ( 0 < count( $missing_tables ) ) {
			update_option( 'automator_schema_missing_tables', $missing_tables );
		} else {
			update_option( 'uap_database_version', AUTOMATOR_DATABASE_VERSION );
			delete_option( 'automator_schema_missing_tables' );
			delete_option( 'automator_schema_missing_views' );
		}

		return $missing_tables;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.0 Introduced.