Changeset 3344786
- Timestamp:
- 08/14/2025 04:33:37 PM (7 months ago)
- Location:
- transfer-brands-for-woocommerce
- Files:
-
- 8 added
- 12 edited
- 1 copied
-
tags/2.8.1 (copied) (copied from transfer-brands-for-woocommerce/trunk)
-
tags/2.8.1/CHANGELOG.md (modified) (1 diff)
-
tags/2.8.1/assets/banner-1544x500.png (added)
-
tags/2.8.1/assets/banner-772x250.png (added)
-
tags/2.8.1/assets/icon-128x128.png (added)
-
tags/2.8.1/assets/icon-256x256.png (added)
-
tags/2.8.1/includes/class-admin.php (modified) (3 diffs)
-
tags/2.8.1/includes/class-ajax.php (modified) (2 diffs)
-
tags/2.8.1/includes/class-core.php (modified) (3 diffs)
-
tags/2.8.1/readme.txt (modified) (1 diff)
-
tags/2.8.1/transfer-brands-for-woocommerce.php (modified) (3 diffs)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/assets/banner-1544x500.png (added)
-
trunk/assets/banner-772x250.png (added)
-
trunk/assets/icon-128x128.png (added)
-
trunk/assets/icon-256x256.png (added)
-
trunk/includes/class-admin.php (modified) (3 diffs)
-
trunk/includes/class-ajax.php (modified) (2 diffs)
-
trunk/includes/class-core.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/transfer-brands-for-woocommerce.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
transfer-brands-for-woocommerce/tags/2.8.1/CHANGELOG.md
r3341810 r3344786 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## [2.8.1] - 2025-08-09 9 10 ### Changed 11 - Buffered debug logging writes to a single shutdown update per request 12 - Limited `tbfw_brands_debug_log` to last 1000 entries to prevent unbounded growth 13 - Ensured heavy options (`tbfw_backup`, `tbfw_term_mappings`, `tbfw_deleted_brands_backup`, `tbfw_brands_processed_ids`, `tbfw_backup_cleanup_log`, `tbfw_brands_debug_log`) are non-autoloaded 14 - Removed global `wp_cache_flush()` usage from admin UI and counts refresh; replaced with targeted cache deletion 15 - Escaped debug output in Debug page to avoid XSS in admin 16 17 ### Fixed 18 - Reduced slow queries on multisite and large stores caused by frequent option reads/writes 7 19 8 20 ## [2.8.0] - 2025-08-08 -
transfer-brands-for-woocommerce/tags/2.8.1/includes/class-admin.php
r3294781 r3344786 524 524 <button class="button" onclick="jQuery('#product-<?php echo esc_attr($product['id']); ?>').toggle();"><?php esc_html_e('Show Details', 'transfer-brands-for-woocommerce'); ?></button> 525 525 <div id="product-<?php echo esc_attr($product['id']); ?>" style="display: none; margin-top: 10px;"> 526 <pre><?php print_r($product['attribute']); ?></pre> 526 <?php $attr_dump = print_r($product['attribute'], true); ?> 527 <pre><?php echo esc_html($attr_dump); ?></pre> 527 528 </div> 528 529 </td> … … 551 552 <button class="button button-small" onclick="jQuery('#log-data-<?php echo esc_attr($index); ?>').toggle();"><?php esc_html_e('Show Data', 'transfer-brands-for-woocommerce'); ?></button> 552 553 <div id="log-data-<?php echo esc_attr($index); ?>" style="display: none; margin-top: 5px; padding: 5px; background: #fff;"> 553 <pre><?php print_r($entry['data']); ?></pre> 554 <?php $data_dump = print_r($entry['data'], true); ?> 555 <pre><?php echo esc_html($data_dump); ?></pre> 554 556 </div> 555 557 <?php endif; ?> … … 587 589 */ 588 590 public function admin_page() { 589 // Clear cache to ensure we have fresh data 590 wp_cache_flush(); 591 // Avoid global cache flush here to prevent heavy performance impact 591 592 592 593 // Get current tab -
transfer-brands-for-woocommerce/tags/2.8.1/includes/class-ajax.php
r3341810 r3344786 585 585 } 586 586 587 // Clear object cache588 wp_cache_flush();589 590 587 // Delete transients that might affect the counts 591 588 delete_transient('tbfw_count_comments'); … … 593 590 delete_transient('wc_term_counts'); 594 591 595 // Clear object cache592 // Clear WooCommerce-related cache keys where possible without global flush 596 593 if (function_exists('wp_cache_delete')) { 597 594 wp_cache_delete('product-transient-version', 'transient'); -
transfer-brands-for-woocommerce/tags/2.8.1/includes/class-core.php
r3294781 r3344786 90 90 */ 91 91 private $debug_log = []; 92 /** 93 * Tracks whether the debug log has been loaded from the database 94 * and whether a single write has been scheduled for shutdown. 95 * 96 * @since 2.8.1 97 * @var bool 98 */ 99 private $has_loaded_debug_log = false; 100 private $has_scheduled_debug_write = false; 92 101 93 102 /** … … 207 216 return; 208 217 } 209 210 $this->debug_log = get_option('tbfw_brands_debug_log', []); 211 218 // Load once per request 219 if (!$this->has_loaded_debug_log) { 220 $this->debug_log = get_option('tbfw_brands_debug_log', []); 221 $this->has_loaded_debug_log = true; 222 } 223 212 224 $this->debug_log[] = [ 213 225 'time' => current_time('mysql'), … … 215 227 'data' => $data 216 228 ]; 217 218 update_option('tbfw_brands_debug_log', $this->debug_log); 229 230 // Schedule a single write at shutdown instead of writing on every call 231 if (!$this->has_scheduled_debug_write) { 232 $this->has_scheduled_debug_write = true; 233 add_action('shutdown', function() { 234 // Cap the log to the most recent 1000 entries to avoid unbounded growth 235 $log = $this->debug_log; 236 if (is_array($log) && count($log) > 1000) { 237 $log = array_slice($log, -1000); 238 } 239 update_option('tbfw_brands_debug_log', $log); 240 }); 241 } 219 242 } 220 243 -
transfer-brands-for-woocommerce/tags/2.8.1/readme.txt
r3341810 r3344786 4 4 Requires at least: 6.0 5 5 Tested up to: 6.8.2 6 Stable tag: 2.8. 06 Stable tag: 2.8.1 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later -
transfer-brands-for-woocommerce/tags/2.8.1/transfer-brands-for-woocommerce.php
r3341810 r3344786 4 4 * Plugin URI: https://pluginatlas.com/transfer-brands-for-woocommerce 5 5 * Description: Official migration tool for WooCommerce 9.6 Brands. Safely transfer your product brand attributes to the new brand taxonomy with image support, batch processing, and full backup capabilities. 6 * Version: 2.8. 06 * Version: 2.8.1 7 7 * Requires at least: 6.0 8 8 * Requires PHP: 7.4 … … 36 36 37 37 // Define plugin constants 38 define('TBFW_VERSION', '2.8. 0');38 define('TBFW_VERSION', '2.8.1'); 39 39 define('TBFW_PLUGIN_DIR', plugin_dir_path(__FILE__)); 40 40 define('TBFW_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 155 155 ]); 156 156 } 157 158 // Ensure debug-related options exist and are not autoloaded to avoid slow autoload queries 159 if (false === get_option('tbfw_brands_debug_log', false)) { 160 add_option('tbfw_brands_debug_log', [], '', 'no'); 161 } else { 162 // If it exists but might be autoloaded, switch to non-autoloaded 163 update_option('tbfw_brands_debug_log', get_option('tbfw_brands_debug_log', []), false); 164 } 165 166 // Pre-create heavy options as non-autoloaded to prevent loading on every request 167 if (false === get_option('tbfw_backup', false)) { 168 add_option('tbfw_backup', [], '', 'no'); 169 } else { 170 update_option('tbfw_backup', get_option('tbfw_backup', []), false); 171 } 172 173 if (false === get_option('tbfw_term_mappings', false)) { 174 add_option('tbfw_term_mappings', [], '', 'no'); 175 } else { 176 update_option('tbfw_term_mappings', get_option('tbfw_term_mappings', []), false); 177 } 178 179 if (false === get_option('tbfw_deleted_brands_backup', false)) { 180 add_option('tbfw_deleted_brands_backup', [], '', 'no'); 181 } else { 182 update_option('tbfw_deleted_brands_backup', get_option('tbfw_deleted_brands_backup', []), false); 183 } 184 185 if (false === get_option('tbfw_brands_processed_ids', false)) { 186 add_option('tbfw_brands_processed_ids', [], '', 'no'); 187 } else { 188 update_option('tbfw_brands_processed_ids', get_option('tbfw_brands_processed_ids', []), false); 189 } 190 191 if (false === get_option('tbfw_backup_cleanup_log', false)) { 192 add_option('tbfw_backup_cleanup_log', [], '', 'no'); 193 } else { 194 update_option('tbfw_backup_cleanup_log', get_option('tbfw_backup_cleanup_log', []), false); 195 } 157 196 158 197 // Flush rewrite rules -
transfer-brands-for-woocommerce/trunk/CHANGELOG.md
r3341810 r3344786 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## [2.8.1] - 2025-08-09 9 10 ### Changed 11 - Buffered debug logging writes to a single shutdown update per request 12 - Limited `tbfw_brands_debug_log` to last 1000 entries to prevent unbounded growth 13 - Ensured heavy options (`tbfw_backup`, `tbfw_term_mappings`, `tbfw_deleted_brands_backup`, `tbfw_brands_processed_ids`, `tbfw_backup_cleanup_log`, `tbfw_brands_debug_log`) are non-autoloaded 14 - Removed global `wp_cache_flush()` usage from admin UI and counts refresh; replaced with targeted cache deletion 15 - Escaped debug output in Debug page to avoid XSS in admin 16 17 ### Fixed 18 - Reduced slow queries on multisite and large stores caused by frequent option reads/writes 7 19 8 20 ## [2.8.0] - 2025-08-08 -
transfer-brands-for-woocommerce/trunk/includes/class-admin.php
r3294781 r3344786 524 524 <button class="button" onclick="jQuery('#product-<?php echo esc_attr($product['id']); ?>').toggle();"><?php esc_html_e('Show Details', 'transfer-brands-for-woocommerce'); ?></button> 525 525 <div id="product-<?php echo esc_attr($product['id']); ?>" style="display: none; margin-top: 10px;"> 526 <pre><?php print_r($product['attribute']); ?></pre> 526 <?php $attr_dump = print_r($product['attribute'], true); ?> 527 <pre><?php echo esc_html($attr_dump); ?></pre> 527 528 </div> 528 529 </td> … … 551 552 <button class="button button-small" onclick="jQuery('#log-data-<?php echo esc_attr($index); ?>').toggle();"><?php esc_html_e('Show Data', 'transfer-brands-for-woocommerce'); ?></button> 552 553 <div id="log-data-<?php echo esc_attr($index); ?>" style="display: none; margin-top: 5px; padding: 5px; background: #fff;"> 553 <pre><?php print_r($entry['data']); ?></pre> 554 <?php $data_dump = print_r($entry['data'], true); ?> 555 <pre><?php echo esc_html($data_dump); ?></pre> 554 556 </div> 555 557 <?php endif; ?> … … 587 589 */ 588 590 public function admin_page() { 589 // Clear cache to ensure we have fresh data 590 wp_cache_flush(); 591 // Avoid global cache flush here to prevent heavy performance impact 591 592 592 593 // Get current tab -
transfer-brands-for-woocommerce/trunk/includes/class-ajax.php
r3341810 r3344786 585 585 } 586 586 587 // Clear object cache588 wp_cache_flush();589 590 587 // Delete transients that might affect the counts 591 588 delete_transient('tbfw_count_comments'); … … 593 590 delete_transient('wc_term_counts'); 594 591 595 // Clear object cache592 // Clear WooCommerce-related cache keys where possible without global flush 596 593 if (function_exists('wp_cache_delete')) { 597 594 wp_cache_delete('product-transient-version', 'transient'); -
transfer-brands-for-woocommerce/trunk/includes/class-core.php
r3294781 r3344786 90 90 */ 91 91 private $debug_log = []; 92 /** 93 * Tracks whether the debug log has been loaded from the database 94 * and whether a single write has been scheduled for shutdown. 95 * 96 * @since 2.8.1 97 * @var bool 98 */ 99 private $has_loaded_debug_log = false; 100 private $has_scheduled_debug_write = false; 92 101 93 102 /** … … 207 216 return; 208 217 } 209 210 $this->debug_log = get_option('tbfw_brands_debug_log', []); 211 218 // Load once per request 219 if (!$this->has_loaded_debug_log) { 220 $this->debug_log = get_option('tbfw_brands_debug_log', []); 221 $this->has_loaded_debug_log = true; 222 } 223 212 224 $this->debug_log[] = [ 213 225 'time' => current_time('mysql'), … … 215 227 'data' => $data 216 228 ]; 217 218 update_option('tbfw_brands_debug_log', $this->debug_log); 229 230 // Schedule a single write at shutdown instead of writing on every call 231 if (!$this->has_scheduled_debug_write) { 232 $this->has_scheduled_debug_write = true; 233 add_action('shutdown', function() { 234 // Cap the log to the most recent 1000 entries to avoid unbounded growth 235 $log = $this->debug_log; 236 if (is_array($log) && count($log) > 1000) { 237 $log = array_slice($log, -1000); 238 } 239 update_option('tbfw_brands_debug_log', $log); 240 }); 241 } 219 242 } 220 243 -
transfer-brands-for-woocommerce/trunk/readme.txt
r3341810 r3344786 4 4 Requires at least: 6.0 5 5 Tested up to: 6.8.2 6 Stable tag: 2.8. 06 Stable tag: 2.8.1 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later -
transfer-brands-for-woocommerce/trunk/transfer-brands-for-woocommerce.php
r3341810 r3344786 4 4 * Plugin URI: https://pluginatlas.com/transfer-brands-for-woocommerce 5 5 * Description: Official migration tool for WooCommerce 9.6 Brands. Safely transfer your product brand attributes to the new brand taxonomy with image support, batch processing, and full backup capabilities. 6 * Version: 2.8. 06 * Version: 2.8.1 7 7 * Requires at least: 6.0 8 8 * Requires PHP: 7.4 … … 36 36 37 37 // Define plugin constants 38 define('TBFW_VERSION', '2.8. 0');38 define('TBFW_VERSION', '2.8.1'); 39 39 define('TBFW_PLUGIN_DIR', plugin_dir_path(__FILE__)); 40 40 define('TBFW_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 155 155 ]); 156 156 } 157 158 // Ensure debug-related options exist and are not autoloaded to avoid slow autoload queries 159 if (false === get_option('tbfw_brands_debug_log', false)) { 160 add_option('tbfw_brands_debug_log', [], '', 'no'); 161 } else { 162 // If it exists but might be autoloaded, switch to non-autoloaded 163 update_option('tbfw_brands_debug_log', get_option('tbfw_brands_debug_log', []), false); 164 } 165 166 // Pre-create heavy options as non-autoloaded to prevent loading on every request 167 if (false === get_option('tbfw_backup', false)) { 168 add_option('tbfw_backup', [], '', 'no'); 169 } else { 170 update_option('tbfw_backup', get_option('tbfw_backup', []), false); 171 } 172 173 if (false === get_option('tbfw_term_mappings', false)) { 174 add_option('tbfw_term_mappings', [], '', 'no'); 175 } else { 176 update_option('tbfw_term_mappings', get_option('tbfw_term_mappings', []), false); 177 } 178 179 if (false === get_option('tbfw_deleted_brands_backup', false)) { 180 add_option('tbfw_deleted_brands_backup', [], '', 'no'); 181 } else { 182 update_option('tbfw_deleted_brands_backup', get_option('tbfw_deleted_brands_backup', []), false); 183 } 184 185 if (false === get_option('tbfw_brands_processed_ids', false)) { 186 add_option('tbfw_brands_processed_ids', [], '', 'no'); 187 } else { 188 update_option('tbfw_brands_processed_ids', get_option('tbfw_brands_processed_ids', []), false); 189 } 190 191 if (false === get_option('tbfw_backup_cleanup_log', false)) { 192 add_option('tbfw_backup_cleanup_log', [], '', 'no'); 193 } else { 194 update_option('tbfw_backup_cleanup_log', get_option('tbfw_backup_cleanup_log', []), false); 195 } 157 196 158 197 // Flush rewrite rules
Note: See TracChangeset
for help on using the changeset viewer.