Changeset 9284
- Timestamp:
- 11/20/2019 06:59:20 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-manager.php
r8975 r9284 310 310 } 311 311 312 /** 313 * Clear caches for memory management. 314 * 315 * @static 316 * @global \wpdb $wpdb 317 * @global \WP_Object_Cache $wp_object_cache 318 */ 319 public static function clear_memory_heavy_variables() { 320 global $wpdb, $wp_object_cache; 321 322 $wpdb->queries = []; 323 324 if ( is_object( $wp_object_cache ) ) { 325 $wp_object_cache->cache = []; 326 $wp_object_cache->group_ops = []; 327 $wp_object_cache->memcache_debug = []; 328 } 329 } 312 330 313 331 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-meta-sync.php
r9140 r9284 26 26 $this->sync_ratings(); 27 27 $this->update_tested_up_to(); 28 29 Manager::clear_memory_heavy_variables(); 28 30 } 29 31 … … 167 169 $tested_values = $wpdb->get_results( "SELECT post_id, post_name, meta_value FROM {$wpdb->postmeta} pm JOIN {$wpdb->posts} p ON pm.post_id = p.ID WHERE meta_key = 'tested' AND meta_value IN( {$tested_meta_value_esc_sql} )" ); 168 170 169 foreach ( $tested_values as $ row ) {171 foreach ( $tested_values as $i => $row ) { 170 172 update_post_meta( 171 173 $row->post_id, … … 176 178 // Update the API endpoints with the new data 177 179 API_Update_Updater::update_single_plugin( $row->post_name ); 180 181 if ( $i % 100 === 0 ) { 182 Manager::clear_memory_heavy_variables(); 183 } 178 184 } 179 185 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-plugin-support-resolved.php
r6571 r9284 70 70 } 71 71 72 self::stop_the_insanity();72 Manager::clear_memory_heavy_variables(); 73 73 } 74 74 } 75 75 76 /**77 * Clear caches for memory management.78 *79 * @static80 * @global \wpdb $wpdb81 * @global \WP_Object_Cache $wp_object_cache82 */83 protected static function stop_the_insanity() {84 global $wpdb, $wp_object_cache;85 86 $wpdb->queries = [];87 88 if ( is_object( $wp_object_cache ) ) {89 $wp_object_cache->cache = [];90 $wp_object_cache->group_ops = [];91 $wp_object_cache->memcache_debug = [];92 $wp_object_cache->stats = [];93 }94 }95 76 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-translation-sync.php
r8461 r9284 30 30 31 31 // Make sure the cache doesn't exhaust memory 32 global $wp_object_cache; 33 if ( is_object( $wp_object_cache ) ) { 34 $wp_object_cache->cache = array(); 35 $wp_object_cache->stats = array( 'add' => 0, 'get' => 0, 'get_multi' => 0, 'delete' => 0); 36 $wp_object_cache->group_ops = array(); 37 } 32 Manager::clear_memory_heavy_variables(); 38 33 39 34 $args['offset'] += $args['posts_per_page'];
Note: See TracChangeset
for help on using the changeset viewer.