Skip to content

Commit 4874549

Browse files
committed
New pro setting: Max Execution Time
1 parent 4bf5aba commit 4874549

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

includes/admin/settings/class-settings.php

+16
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,22 @@ public static function settings_general() {
318318
'options' => self::get_user_roles( array( 'administrator' ) ),
319319
'pro' => true,
320320
),
321+
'query_optimization' => array(
322+
'id' => 'query_optimization',
323+
'name' => '<h3>' . esc_html__( 'Query Optimization', 'top-10' ) . '</h3>',
324+
'desc' => esc_html__( 'Settings for optimizing database queries', 'top-10' ),
325+
'type' => 'header',
326+
),
327+
'max_execution_time' => array(
328+
'id' => 'max_execution_time',
329+
'name' => esc_html__( 'Max Execution Time', 'top-10' ),
330+
'desc' => esc_html__( 'Maximum execution time for MySQL queries in milliseconds. Set to 0 to disable. Default is 3000 (3 seconds).', 'top-10' ),
331+
'type' => 'number',
332+
'options' => 3000,
333+
'min' => 0,
334+
'step' => 100,
335+
'pro' => true,
336+
),
321337
);
322338

323339
/**

readme.txt

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Top 10 also has powerful API and is fully extendable with WordPress actions and
5959
* **Enhanced Tracking and Performance**
6060
- **Fast Tracker**: A new, faster tracking method to improve post view speed.
6161
- **Query Filters**: Enable parent term inclusion in post queries for more accurate filtering.
62+
- **Query Optimization**: Add MySQL MAX_EXECUTION_TIME directive to prevent long-running queries from consuming excessive server resources. Configurable via settings and the `top_ten_query_max_execution_time` filter.
6263

6364
* **Developer-Friendly Features**
6465
- **Filters and Hooks**: New filters like `top_ten_query_exclude_terms_include_parents`, `top_ten_query_include_terms_include_parents`, and `get_tptn_short_circuit` for greater customisation.
@@ -153,6 +154,7 @@ When you enabled the scheduled maintenance, Top 10 will create a cron job that w
153154

154155
* Features:
155156
* Import data from WordPress Popular Posts plugin.
157+
* [Pro] Query Optimization: Add MySQL MAX_EXECUTION_TIME directive to prevent long-running queries from consuming excessive server resources. Configurable via settings and the `top_ten_query_max_execution_time` filter.
156158
* Admin Dashboard:
157159
* Smart chart visualization: Automatically switches to an area chart for datasets with more than 100 data points.
158160
* [Pro] Clicking on a column in the Popular Posts chart will display the most popular posts for the selected day.

0 commit comments

Comments
 (0)