Changes between Initial Version and Version 4 of Ticket #40404
- Timestamp:
- 02/12/2025 04:14:16 PM (12 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #40404
-
Property
Component
changed from
GeneraltoQuery -
Property
Summary
changed from
Slow sampling when a large number of posts from a big 10-ing thousandtoSlow queries with a large number of posts (tens of thousands and above)
-
Property
Component
changed from
-
Ticket #40404 – Description
initial v4 7 7 To store "lists" of sorting in the database was created table: 8 8 9 ### 9 {{{ 10 10 CREATE TABLE `wp_сорт` ( 11 11 `номер_сорта` int(10) unsigned NOT NULL AUTO_INCREMENT, … … 31 31 CONSTRAINT `внешка_сорта` FOREIGN KEY (`номер_сорта`) REFERENCES `wp_сорт` (`номер_сорта`) ON DELETE CASCADE ON UPDATE CASCADE 32 32 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 33 ### 34 35 Modification of the file wp-includes/class-wp-query.php in the function get_posts ()somewhere 2513 string to find:36 37 ### 33 }}} 34 35 Modification of the file `wp-includes/class-wp-query.php` in the function `get_posts()` somewhere 2513 string to find: 36 37 38 38 {{{#!php 39 39 <?php … … 41 41 // First get the IDs and then fill in the objects 42 42 }}} 43 ### 43 44 44 45 45 and insert the following: 46 46 47 ### 47 48 48 {{{#!php 49 49 <?php … … 130 130 } 131 131 }}} 132 ### 133 134 To give the number of records in set_found_postsfunction ( $q, $limits ) change:135 136 ### 132 133 134 To give the number of records in `set_found_posts` function ( $q, $limits ) change: 135 136 137 137 {{{#!php 138 138 <?php 139 139 $this->found_posts = $wpdb->get_var ( apply_filters_ref_array ( 'found_posts_query', [ 'SELECT FOUND_ROWS()', &$this ] ) ); 140 140 }}} 141 ### 141 142 142 143 143 on: 144 144 145 ### 145 146 146 {{{#!php 147 147 <?php … … 151 151 $this->found_posts = $wpdb->get_var ( apply_filters_ref_array ( 'found_posts_query', [ 'SELECT FOUND_ROWS()', &$this ] ) ); 152 152 }}} 153 ### 153 154 154 155 155 in cron you need to add one-time during installation, for example, the plugin task: 156 156 157 ###158 157 {{{#!php 159 158 <?php 160 159 wp_schedule_event ( time (), 'wp_wc_updater_cron_interval', 'xray_sorting_event' ); 161 160 }}} 162 ### 161 163 162 164 163 at the event: 165 164 166 ### 165 167 166 {{{#!php 168 167 <?php 169 168 add_action ( 'xray_sorting_event', 'xray_sorting_event_func' ); 170 169 }}} 171 ### 170 172 171 173 172 and, accordingly, the function itself: 174 173 175 ### 174 176 175 {{{#!php 177 176 <?php … … 220 219 } 221 220 }}} 222 ### 221 223 222 224 223 I repeat that this is a working model. Can requires file. But all the errors which may be in code(commas, spaces, something like that) is the problem of copy-paste.