Changeset 3489019
- Timestamp:
- 03/23/2026 12:59:45 PM (10 days ago)
- Location:
- head-footer-code
- Files:
-
- 32 added
- 4 edited
-
tags/1.5.6 (added)
-
tags/1.5.6/LICENSE (added)
-
tags/1.5.6/assets (added)
-
tags/1.5.6/assets/css (added)
-
tags/1.5.6/assets/css/admin.min.css (added)
-
tags/1.5.6/assets/css/admin.min.css.map (added)
-
tags/1.5.6/assets/css/edit.min.css (added)
-
tags/1.5.6/assets/css/edit.min.css.map (added)
-
tags/1.5.6/assets/scss (added)
-
tags/1.5.6/assets/scss/admin.scss (added)
-
tags/1.5.6/assets/scss/edit.scss (added)
-
tags/1.5.6/changelog.txt (added)
-
tags/1.5.6/classes (added)
-
tags/1.5.6/classes/autoload.php (added)
-
tags/1.5.6/classes/techwebux (added)
-
tags/1.5.6/classes/techwebux/hfc (added)
-
tags/1.5.6/classes/techwebux/hfc/class-common.php (added)
-
tags/1.5.6/classes/techwebux/hfc/class-front.php (added)
-
tags/1.5.6/classes/techwebux/hfc/class-grid.php (added)
-
tags/1.5.6/classes/techwebux/hfc/class-main.php (added)
-
tags/1.5.6/classes/techwebux/hfc/class-metabox-article.php (added)
-
tags/1.5.6/classes/techwebux/hfc/class-metabox-taxonomy.php (added)
-
tags/1.5.6/classes/techwebux/hfc/class-plugin-info.php (added)
-
tags/1.5.6/classes/techwebux/hfc/class-settings.php (added)
-
tags/1.5.6/head-footer-code.php (added)
-
tags/1.5.6/index.php (added)
-
tags/1.5.6/readme.txt (added)
-
tags/1.5.6/templates (added)
-
tags/1.5.6/templates/hfc-form.php (added)
-
tags/1.5.6/templates/settings.php (added)
-
tags/1.5.6/uninstall.php (added)
-
tags/1.5.6/update.php (added)
-
trunk/classes/techwebux/hfc/class-main.php (modified) (1 diff)
-
trunk/head-footer-code.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/update.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
head-footer-code/trunk/classes/techwebux/hfc/class-main.php
r3479175 r3489019 106 106 } 107 107 108 // Lock initiated updating 109 if ( get_transient( 'auhfc_updating' ) ) { 110 return; 111 } 112 set_transient( 'auhfc_updating', true, 5 * MINUTE_IN_SECONDS ); 113 108 114 // Require update script and trigger update function. 109 115 require_once $this->plugin->dir . '/update.php'; 110 116 auhfc_update(); 117 118 // Remove updating lock 119 delete_transient( 'auhfc_updating' ); 111 120 } 112 121 -
head-footer-code/trunk/head-footer-code.php
r3480015 r3489019 12 12 * Plugin URI: https://urosevic.net/wordpress/plugins/head-footer-code/ 13 13 * Description: Easy add site-wide, category or article specific custom code before the closing <strong></head></strong> and <strong></body></strong> or after opening <strong><body></strong> HTML tag. 14 * Version: 1.5. 514 * Version: 1.5.6 15 15 * Author: Aleksandar Urošević 16 16 * Author URI: https://urosevic.net/ … … 31 31 define( 'HFC__MIN_WP', '5.2' ); 32 32 33 define( 'HFC_VER', '1.5. 5' );33 define( 'HFC_VER', '1.5.6' ); 34 34 define( 'HFC_VER_DB', '11' ); 35 35 define( 'HFC_FILE', __FILE__ ); -
head-footer-code/trunk/readme.txt
r3480015 r3489019 6 6 Requires at least: 5.2 7 7 Tested up to: 7.0 8 Stable tag: 1.5. 58 Stable tag: 1.5.6 9 9 Requires PHP: 5.6 10 10 License: GPLv3 … … 194 194 ## Changelog 195 195 196 ### 1.5.6 (2026-03-23) 197 * Fix: update routine 10 infinite loop on sites with huge number of posts (10k+) 198 * Test: WordPress 7.0-beta6 199 196 200 ### 1.5.5 (2026-03-11) 197 201 * Fix: Remove `set_time_limit` from `update.php` to prevent fatal error on servers where it's disabled -
head-footer-code/trunk/update.php
r3480015 r3489019 254 254 * Migration for v. 1.5.3 255 255 * Clean up double slashes from existing meta data caused by previous double-slashing. 256 * Processes 500 records at a time and stays on DB version 9 until 257 * all records are cleaned to prevent timeouts and memory exhaustion. 256 258 */ 257 259 function auhfc_update_10() { 258 260 global $wpdb; 259 261 260 $meta_key = '_auhfc'; 262 $meta_key = '_auhfc'; 263 $batch_size = 500; 264 $has_more = false; 261 265 262 266 /** 263 * Strip slashes from Post Metas 264 * We use direct SQL to fetch all IDs at once to avoid N+1 query issues 265 * and memory exhaustion on large databases. 267 * Strip slashes from Post Metas when actually contain backslashes (\\) in meta_value. 266 268 */ 267 269 $post_metas = $wpdb->get_results( 268 270 $wpdb->prepare( 269 "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = %s", 270 $meta_key 271 "SELECT post_id, meta_value FROM $wpdb->postmeta 272 WHERE meta_key = %s AND meta_value LIKE %s 273 LIMIT %d", 274 $meta_key, 275 '%' . $wpdb->esc_like( '\\' ) . '%', 276 $batch_size 271 277 ) 272 278 ); 273 279 274 280 if ( ! empty( $post_metas ) ) { 281 $has_more = true; 275 282 foreach ( $post_metas as $meta ) { 276 283 $original_data = maybe_unserialize( $meta->meta_value ); … … 278 285 if ( is_array( $original_data ) ) { 279 286 $cleaned_data = stripslashes_deep( $original_data ); 280 update_post_meta( $meta->post_id, $meta_key, wp_slash( $cleaned_data ) ); 287 if ( $cleaned_data !== $original_data ) { 288 update_post_meta( $meta->post_id, $meta_key, wp_slash( $cleaned_data ) ); 289 } 281 290 } 282 291 } … … 284 293 285 294 /** 286 * Strip slashes from Taxonomies ( Categories at the moment)295 * Strip slashes from Taxonomies (Terms) within available batch capacity. 287 296 */ 288 $term_metas = $wpdb->get_results( 289 $wpdb->prepare( 290 "SELECT term_id, meta_value FROM $wpdb->termmeta WHERE meta_key = %s", 291 $meta_key 292 ) 293 ); 294 295 if ( ! empty( $term_metas ) ) { 296 foreach ( $term_metas as $meta ) { 297 $original_data = maybe_unserialize( $meta->meta_value ); 298 299 if ( is_array( $original_data ) ) { 300 $cleaned_data = stripslashes_deep( $original_data ); 301 update_term_meta( $meta->term_id, $meta_key, wp_slash( $cleaned_data ) ); 297 if ( count( $post_metas ) < $batch_size ) { 298 $term_metas = $wpdb->get_results( 299 $wpdb->prepare( 300 "SELECT term_id, meta_value FROM $wpdb->termmeta 301 WHERE meta_key = %s AND meta_value LIKE %s 302 LIMIT %d", 303 $meta_key, 304 '%' . $wpdb->esc_like( '\\' ) . '%', 305 $batch_size - count( $post_metas ) 306 ) 307 ); 308 309 if ( ! empty( $term_metas ) ) { 310 $has_more = true; 311 foreach ( $term_metas as $meta ) { 312 $original_data = maybe_unserialize( $meta->meta_value ); 313 314 if ( is_array( $original_data ) ) { 315 $cleaned_data = stripslashes_deep( $original_data ); 316 if ( $cleaned_data !== $original_data ) { 317 update_term_meta( $meta->term_id, $meta_key, wp_slash( $cleaned_data ) ); 318 } 319 } 302 320 } 303 321 } 322 } 323 324 /** 325 * Revert DB versin if there is more work in batches so 326 * Main::plugins_loaded() triggers this function agaiuntil completion. 327 */ 328 if ( $has_more ) { 329 update_option( 'auhfc_db_ver', 9 ); 304 330 } 305 331 }
Note: See TracChangeset
for help on using the changeset viewer.