| @@ -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( |
| @@ -86,8 +87,9 @@ | ||
| 86 | 87 | ]; |
| 87 | 88 | |
| 88 | 89 | foreach ($tables as $table) { |
| 89 | 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. | |
| 90 | 92 | $wpdb->query("DROP TABLE IF EXISTS {$table}"); |
| 91 | 93 | } |
| 92 | 94 | } |
| 93 | 95 | |
| @@ -112,8 +114,9 @@ | ||
| 112 | 114 | '_site_transient_timeout_UpdateSingleProduct_%_process_lock', |
| 113 | 115 | ] |
| 114 | 116 | ); |
| 115 | 117 | |
| 118 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Plugin uninstall cleanup on core usermeta table; no object cache applicable. | |
| 116 | 119 | $wpdb->query( |
| 117 | 120 | $wpdb->prepare( |
| 118 | 121 | "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE %s", |
| 119 | 122 | 'sync_basalam_%' |
| @@ -119,8 +122,9 @@ | ||
| 119 | 122 | 'sync_basalam_%' |
| 120 | 123 | ) |
| 121 | 124 | ); |
| 122 | 125 | |
| 126 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Plugin uninstall cleanup on core postmeta table; no object cache applicable. | |
| 123 | 127 | $wpdb->query( |
| 124 | 128 | $wpdb->prepare( |
| 125 | 129 | "DELETE FROM {$wpdb->postmeta} |
| 126 | 130 | WHERE meta_key LIKE %s |
| @@ -137,9 +141,9 @@ | ||
| 137 | 141 | '_basalam_order_tracking_code', |
| 138 | 142 | '_basalam_fee_amount', |
| 139 | 143 | '_basalam_balance_amount', |
| 140 | 144 | '_basalam_purchase_count', |
| 141 | - '_sync_basalam_increase_price_value' | |
| 145 | + '_sync_basalam_price_change_value' | |
| 142 | 146 | ) |
| 143 | 147 | ); |
| 144 | 148 | |
| 145 | 149 | wp_cache_flush(); |
| @@ -214,8 +218,9 @@ | ||
| 214 | 218 | if (!sync_basalam_table_exists($actions_table)) { |
| 215 | 219 | return; |
| 216 | 220 | } |
| 217 | 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. | |
| 218 | 223 | $wpdb->query( |
| 219 | 224 | $wpdb->prepare( |
| 220 | 225 | "DELETE FROM {$actions_table} |
| 221 | 226 | WHERE hook LIKE %s |
| @@ -230,8 +235,9 @@ | ||
| 230 | 235 | if (!sync_basalam_table_exists($groups_table)) { |
| 231 | 236 | return; |
| 232 | 237 | } |
| 233 | 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. | |
| 234 | 240 | $group_ids = $wpdb->get_col( |
| 235 | 241 | $wpdb->prepare( |
| 236 | 242 | "SELECT group_id FROM {$groups_table} WHERE slug = %s", |
| 237 | 243 | 'sync-basalam' |
| @@ -250,9 +256,11 @@ | ||
| 250 | 256 | } |
| 251 | 257 | |
| 252 | 258 | $ids = implode(',', $group_ids); |
| 253 | 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. | |
| 254 | 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. | |
| 255 | 263 | $wpdb->query("DELETE FROM {$groups_table} WHERE group_id IN ({$ids})"); |
| 256 | 264 | } |
| 257 | 265 | |
| 258 | 266 | function sync_basalam_cleanup_network_site_transients(): void |
| @@ -272,8 +280,9 @@ | ||
| 272 | 280 | '_site_transient_timeout_UpdateSingleProduct_%', |
| 273 | 281 | ]; |
| 274 | 282 | |
| 275 | 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. | |
| 276 | 285 | $wpdb->query( |
| 277 | 286 | $wpdb->prepare( |
| 278 | 287 | "DELETE FROM {$wpdb->sitemeta} WHERE meta_key LIKE %s", |
| 279 | 288 | $pattern |
| @@ -286,8 +295,9 @@ | ||
| 286 | 295 | { |
| 287 | 296 | global $wpdb; |
| 288 | 297 | |
| 289 | 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. | |
| 290 | 300 | $wpdb->query( |
| 291 | 301 | $wpdb->prepare( |
| 292 | 302 | "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", |
| 293 | 303 | $pattern |
| @@ -299,8 +309,9 @@ | ||
| 299 | 309 | function sync_basalam_table_exists(string $table_name): bool |
| 300 | 310 | { |
| 301 | 311 | global $wpdb; |
| 302 | 312 | |
| 313 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Table existence check; no object cache applicable. | |
| 303 | 314 | $table = $wpdb->get_var( |
| 304 | 315 | $wpdb->prepare( |
| 305 | 316 | 'SHOW TABLES LIKE %s', |
| 306 | 317 | $table_name |