| @@ -12,8 +12,9 @@ | ||
| 12 | 12 | { |
| 13 | 13 | global $wpdb; |
| 14 | 14 | $tableName = $wpdb->prefix . 'sync_basalam_category_mappings'; |
| 15 | 15 | |
| 16 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Custom plugin table; identifier from $wpdb->prefix, not user input. | |
| 16 | 17 | $oldDataExists = $wpdb->get_var("SHOW COLUMNS FROM $tableName LIKE 'basalam_category_id'"); |
| 17 | 18 | |
| 18 | 19 | if (!$oldDataExists) return; |
| 19 | 20 | |
| @@ -23,8 +24,9 @@ | ||
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | private function addNewColumns($wpdb, $tableName) |
| 26 | 27 | { |
| 28 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Migration schema change on own plugin table; identifier from $wpdb->prefix, not user input. | |
| 27 | 29 | $wpdb->query("ALTER TABLE $tableName |
| 28 | 30 | ADD COLUMN basalam_category_level1 INT(11) DEFAULT NULL AFTER woo_category_name, |
| 29 | 31 | ADD COLUMN basalam_category_level2 INT(11) DEFAULT NULL AFTER basalam_category_level1, |
| 30 | 32 | ADD COLUMN basalam_category_level3 INT(11) DEFAULT NULL AFTER basalam_category_level2 |
| @@ -29,8 +31,9 @@ | ||
| 29 | 31 | ADD COLUMN basalam_category_level2 INT(11) DEFAULT NULL AFTER basalam_category_level1, |
| 30 | 32 | ADD COLUMN basalam_category_level3 INT(11) DEFAULT NULL AFTER basalam_category_level2 |
| 31 | 33 | "); |
| 32 | 34 | |
| 35 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Migration schema change on own plugin table; identifier from $wpdb->prefix, not user input. | |
| 33 | 36 | $wpdb->query("ALTER TABLE $tableName |
| 34 | 37 | ADD INDEX basalam_category_level1_idx (basalam_category_level1) |
| 35 | 38 | "); |
| 36 | 39 | } |
| @@ -36,8 +39,10 @@ | ||
| 36 | 39 | } |
| 37 | 40 | |
| 38 | 41 | private function removeOldColumn($wpdb, $tableName) |
| 39 | 42 | { |
| 43 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Migration schema change on own plugin table; identifier from $wpdb->prefix, not user input. | |
| 40 | 44 | $wpdb->query("ALTER TABLE $tableName DROP INDEX basalam_category_idx"); |
| 45 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Migration schema change on own plugin table; identifier from $wpdb->prefix, not user input. | |
| 41 | 46 | $wpdb->query("ALTER TABLE $tableName DROP COLUMN basalam_category_id"); |
| 42 | 47 | } |
| 43 | 48 | } |