PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.13.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.13.0
2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 All 80 releases
← All changes | includes/database/create-form-table.php +11 -2 2.9.12.13.0 View file →
@@ -6,8 +6,9 @@
6 6 }
7 7
8 8 class CreateFormTable {
9 9 public static function up( $prefix, $charset_collate ) {
10 + global $wpdb;
10 11 $table_entries = $prefix . ABLOCKS_PLUGIN_SLUG . '_form_entries';
11 12 $table_meta = $prefix . ABLOCKS_PLUGIN_SLUG . '_form_meta';
12 13
13 14 $sql_entries = "CREATE TABLE $table_entries (
@@ -39,10 +40,17 @@
39 40 PRIMARY KEY (meta_id),
40 41 FOREIGN KEY (entry_id) REFERENCES $table_entries(id) ON DELETE CASCADE ON UPDATE CASCADE
41 42 ) $charset_collate;";
42 43
43 - dbDelta( $sql_entries );
44 - dbDelta( $sql_meta );
44 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
45 + if ( $wpdb->get_var( "SHOW TABLES LIKE '{$table_entries}'" ) !== $table_entries ) {
46 + dbDelta( $sql_entries );
47 + }
48 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
49 + if ( $wpdb->get_var( "SHOW TABLES LIKE '{$table_meta}'" ) !== $table_meta ) {
50 + dbDelta( $sql_meta );
51 + }
52 +
45 53 }
46 54 public static function down( $prefix ) {
47 55 global $wpdb;
48 56
@@ -49,7 +57,8 @@
49 57 $table_entries = $prefix . ABLOCKS_PLUGIN_SLUG . '_form_entries';
50 58 $table_meta = $prefix . ABLOCKS_PLUGIN_SLUG . '_form_meta';
51 59
52 60 $sql = "DROP TABLE IF EXISTS $table_meta, $table_entries;";
61 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
53 62 $wpdb->query( $sql );
54 63 }
55 64 }