| @@ -35,8 +35,9 @@ | ||
| 35 | 35 | sync_basalam_delete_action_scheduler_rows(); |
| 36 | 36 | |
| 37 | 37 | $job_manager_table = $wpdb->prefix . 'sync_basalam_job_manager'; |
| 38 | 38 | if (sync_basalam_table_exists($job_manager_table)) { |
| 39 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Custom plugin table; identifier from $wpdb->prefix, not user input. | |
| 39 | 40 | $wpdb->query("DELETE FROM {$job_manager_table}"); |
| 40 | 41 | } |
| 41 | 42 | |
| 42 | 43 | sync_basalam_delete_option_rows_like( |
| @@ -69,14 +70,15 @@ | ||
| 69 | 70 | |
| 70 | 71 | $tables = [ |
| 71 | 72 | $wpdb->prefix . 'sync_basalam_payments', |
| 72 | 73 | $wpdb->prefix . 'sync_basalam_map_options', |
| 73 | - $wpdb->prefix . 'sync_basalam_uploaded_photo', | |
| 74 | + $wpdb->prefix . 'sync_basalam_uploaded_media', | |
| 74 | 75 | $wpdb->prefix . 'sync_basalam_debug_logs', |
| 75 | 76 | $wpdb->prefix . 'sync_basalam_discount_tasks', |
| 76 | 77 | $wpdb->prefix . 'sync_basalam_category_mappings', |
| 77 | 78 | $wpdb->prefix . 'sync_basalam_job_manager', |
| 78 | 79 | // Legacy tables from older naming/migrations. |
| 80 | + $wpdb->prefix . 'sync_basalam_uploaded_photo', | |
| 79 | 81 | $wpdb->prefix . 'bsl_payments', |
| 80 | 82 | $wpdb->prefix . 'bsl_map_options', |
| 81 | 83 | $wpdb->prefix . 'bsl_uploaded_photo', |
| 82 | 84 | $wpdb->prefix . 'bsl_payments_old', |
| @@ -85,8 +87,9 @@ | ||
| 85 | 87 | ]; |
| 86 | 88 | |
| 87 | 89 | foreach ($tables as $table) { |
| 88 | 90 | if (sync_basalam_table_exists($table)) { |
| 91 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Plugin uninstall drops own tables; identifier from $wpdb->prefix, not user input. | |
| 89 | 92 | $wpdb->query("DROP TABLE IF EXISTS {$table}"); |
| 90 | 93 | } |
| 91 | 94 | } |
| 92 | 95 | |
| @@ -111,8 +114,9 @@ | ||
| 111 | 114 | '_site_transient_timeout_UpdateSingleProduct_%_process_lock', |
| 112 | 115 | ] |
| 113 | 116 | ); |
| 114 | 117 | |
| 118 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Plugin uninstall cleanup on core usermeta table; no object cache applicable. | |
| 115 | 119 | $wpdb->query( |
| 116 | 120 | $wpdb->prepare( |
| 117 | 121 | "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE %s", |
| 118 | 122 | 'sync_basalam_%' |
| @@ -118,8 +122,9 @@ | ||
| 118 | 122 | 'sync_basalam_%' |
| 119 | 123 | ) |
| 120 | 124 | ); |
| 121 | 125 | |
| 126 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Plugin uninstall cleanup on core postmeta table; no object cache applicable. | |
| 122 | 127 | $wpdb->query( |
| 123 | 128 | $wpdb->prepare( |
| 124 | 129 | "DELETE FROM {$wpdb->postmeta} |
| 125 | 130 | WHERE meta_key LIKE %s |
| @@ -136,9 +141,9 @@ | ||
| 136 | 141 | '_basalam_order_tracking_code', |
| 137 | 142 | '_basalam_fee_amount', |
| 138 | 143 | '_basalam_balance_amount', |
| 139 | 144 | '_basalam_purchase_count', |
| 140 | - '_sync_basalam_increase_price_value' | |
| 145 | + '_sync_basalam_price_change_value' | |
| 141 | 146 | ) |
| 142 | 147 | ); |
| 143 | 148 | |
| 144 | 149 | wp_cache_flush(); |
| @@ -213,8 +218,9 @@ | ||
| 213 | 218 | if (!sync_basalam_table_exists($actions_table)) { |
| 214 | 219 | return; |
| 215 | 220 | } |
| 216 | 221 | |
| 222 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Action Scheduler table; identifier from $wpdb->prefix, not user input. | |
| 217 | 223 | $wpdb->query( |
| 218 | 224 | $wpdb->prepare( |
| 219 | 225 | "DELETE FROM {$actions_table} |
| 220 | 226 | WHERE hook LIKE %s |
| @@ -229,8 +235,9 @@ | ||
| 229 | 235 | if (!sync_basalam_table_exists($groups_table)) { |
| 230 | 236 | return; |
| 231 | 237 | } |
| 232 | 238 | |
| 239 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Action Scheduler table; identifier from $wpdb->prefix, not user input. | |
| 233 | 240 | $group_ids = $wpdb->get_col( |
| 234 | 241 | $wpdb->prepare( |
| 235 | 242 | "SELECT group_id FROM {$groups_table} WHERE slug = %s", |
| 236 | 243 | 'sync-basalam' |
| @@ -249,9 +256,11 @@ | ||
| 249 | 256 | } |
| 250 | 257 | |
| 251 | 258 | $ids = implode(',', $group_ids); |
| 252 | 259 | |
| 260 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Action Scheduler table; identifier from $wpdb->prefix and intval-sanitized ID list, not user input. | |
| 253 | 261 | $wpdb->query("DELETE FROM {$actions_table} WHERE group_id IN ({$ids})"); |
| 262 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Action Scheduler table; identifier from $wpdb->prefix and intval-sanitized ID list, not user input. | |
| 254 | 263 | $wpdb->query("DELETE FROM {$groups_table} WHERE group_id IN ({$ids})"); |
| 255 | 264 | } |
| 256 | 265 | |
| 257 | 266 | function sync_basalam_cleanup_network_site_transients(): void |
| @@ -271,8 +280,9 @@ | ||
| 271 | 280 | '_site_transient_timeout_UpdateSingleProduct_%', |
| 272 | 281 | ]; |
| 273 | 282 | |
| 274 | 283 | foreach ($patterns as $pattern) { |
| 284 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Multisite uninstall cleanup on core sitemeta table; no object cache applicable. | |
| 275 | 285 | $wpdb->query( |
| 276 | 286 | $wpdb->prepare( |
| 277 | 287 | "DELETE FROM {$wpdb->sitemeta} WHERE meta_key LIKE %s", |
| 278 | 288 | $pattern |
| @@ -285,8 +295,9 @@ | ||
| 285 | 295 | { |
| 286 | 296 | global $wpdb; |
| 287 | 297 | |
| 288 | 298 | foreach ($patterns as $pattern) { |
| 299 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Plugin uninstall cleanup on core options table; no object cache applicable. | |
| 289 | 300 | $wpdb->query( |
| 290 | 301 | $wpdb->prepare( |
| 291 | 302 | "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", |
| 292 | 303 | $pattern |
| @@ -298,8 +309,9 @@ | ||
| 298 | 309 | function sync_basalam_table_exists(string $table_name): bool |
| 299 | 310 | { |
| 300 | 311 | global $wpdb; |
| 301 | 312 | |
| 313 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Table existence check; no object cache applicable. | |
| 302 | 314 | $table = $wpdb->get_var( |
| 303 | 315 | $wpdb->prepare( |
| 304 | 316 | 'SHOW TABLES LIKE %s', |
| 305 | 317 | $table_name |