Changeset 2926579
- Timestamp:
- 06/15/2023 12:41:12 PM (14 months ago)
- Location:
- mariadb-health-checks
- Files:
-
- 68 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
mariadb-health-checks/trunk/inc/App/ExecutionTime.php
r2907902 r2926579 12 12 global $wpdb; 13 13 14 if( !empty( $wpdb->total_query_time ) && !empty( $wpdb->num_queries ) && $wpdb->num_queries > 0 ) { 15 16 $average = $wpdb->total_query_time / $wpdb->num_queries; 17 18 $wpdb->insert( 19 $wpdb->prefix . self::TABLE_NAME, 20 [ 21 'seconds' => $average, 22 'queries_num' => $wpdb->num_queries 23 ] 24 ); 25 14 if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) { 15 if ( !empty($wpdb->queries) && !empty($wpdb->num_queries) && $wpdb->num_queries > 0) { 16 $query_times = array(); 17 foreach ( $wpdb->queries as $key => $value ) { 18 $query_times[] = $value[1]; 19 } 20 $wpdb->insert( 21 $wpdb->prefix . self::TABLE_NAME, 22 [ 23 'seconds' => array_sum($query_times), 24 'queries_num' => $wpdb->num_queries 25 ] 26 ); 27 } 28 } else { 29 if( !empty( $wpdb->total_query_time ) && !empty( $wpdb->num_queries ) && $wpdb->num_queries > 0 ) { 30 $wpdb->insert( 31 $wpdb->prefix . self::TABLE_NAME, 32 [ 33 'seconds' => $wpdb->total_query_time, 34 'queries_num' => $wpdb->num_queries 35 ] 36 ); 37 } 26 38 } 27 39 } … … 29 41 public function get() { 30 42 global $wpdb; 31 $query = "select timestampdiff(HOUR, ts, now()) as 'hours-ago', avg(seconds) as 'avg-seconds', sum(queries_num) as 'queries-num' from " . $wpdb->prefix . "mariadb_execution_time where date(ts) >= now() - interval 7 day group by timestampdiff(HOUR, ts, now()) order by ts;";43 $query = "select timestampdiff(HOUR, ts, now()) as 'hours-ago', ' from " . $wpdb->prefix . "mariadb_execution_time where date(ts) >= now() - interval 7 day group by timestampdiff(HOUR, ts, now()) order by ts;"; 32 44 $resultsDb = $wpdb->get_results($query, ARRAY_A); 33 45 $results = []; … … 38 50 $results[$k]['microseconds'] = $r['avg-seconds'] * 1000000; 39 51 $results[$k]['queries-num'] = $r['queries-num']; 52 53 40 54 } 41 55 … … 46 60 { 47 61 global $wpdb; 48 $query = "select timestampdiff(HOUR, ts, now()) as 'hours-ago', avg(seconds) as 'avg-seconds', sum(queries_num) as 'queries-num' from " . $wpdb->prefix . "mariadb_execution_time where date(ts) >= now() - interval 7 day group by timestampdiff(HOUR, ts, now()) order by ts;";62 $query = "select timestampdiff(HOUR, ts, now()) as 'hours-ago', ' from " . $wpdb->prefix . "mariadb_execution_time where date(ts) >= now() - interval 7 day group by timestampdiff(HOUR, ts, now()) order by ts;"; 49 63 return $wpdb->get_results( $query, ARRAY_A ); 50 64 } -
mariadb-health-checks/trunk/inc/App/GeneralData.php
r2923325 r2926579 2 2 /** 3 3 * @package MariaDB_Health_Checks 4 * @version 1. 0.34 * @version 1. 5 5 */ 6 6 -
mariadb-health-checks/trunk/inc/functions.php
r2892479 r2926579 73 73 global $wpdb; 74 74 75 return $wpdb->get_var( "SELECT V ERSION();" );75 return $wpdb->get_var( "SELECT V;" ); 76 76 } 77 77 -
mariadb-health-checks/trunk/inc/hooks.php
r2907902 r2926579 38 38 } 39 39 40 $tmp = new MDB_DB(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); 41 $tmp->loadFromParentObj($wpdb); 42 $wpdb = $tmp; 40 // If savequeries is set, let's not duplicate effort 41 if ( !defined( 'SAVEQUERIES' ) || !SAVEQUERIES ) { 42 $tmp = new MDB_DB(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); 43 $tmp->loadFromParentObj($wpdb); 44 $wpdb = $tmp; 45 } 43 46 44 47 function mdbhc_save_average_query_execution_time() -
mariadb-health-checks/trunk/js/scripts.js
r2892479 r2926579 10 10 const execTime = []; 11 11 const averageQueries = []; 12 13 14 15 16 12 17 13 18 response.data.forEach((res, i) => { … … 15 20 var time_vals = {x: res.date * 1000, y: Math.round(res.microseconds)}; 16 21 var query_vals = {x: res.date * 1000, y: res["queries-num"]}; 22 23 17 24 execTime.push(time_vals); 18 25 averageQueries.push(query_vals); 26 27 19 28 }); 20 29 21 30 var datasets = [ 22 31 { 23 label: "Average execution time in μS",24 data: execTime,32 label: "Average ", 33 data: e, 25 34 borderWidth: 1, 26 35 yAxisID: "y", 27 36 }, 28 37 { 29 label: "Queries", 38 label: "Average queries per page", 39 data: queriesPerPage, 40 borderWidth: 1, 41 yAxisID: "y1", 42 }, 43 { 44 label: "Average DB time per query in μs", 45 data: execTime, 46 borderWidth: 1, 47 yAxisID: "y", 48 hidden: true 49 }, 50 { 51 label: "Total hourly queries", 30 52 data: averageQueries, 31 53 borderWidth: 1, 32 54 yAxisID: "y1", 33 } 55 hidden: true 56 }, 57 58 34 59 ]; 35 60 … … 46 71 datasets[1].borderWidth = 3; 47 72 datasets[1].borderColor = redColor; 73 74 75 76 48 77 } 49 78 … … 60 89 title: { 61 90 display: true, 62 text: " Executiontime",91 text: " time", 63 92 color: blueColor, 64 93 font: { … … 76 105 title: { 77 106 display: true, 78 text: "Quer ies",107 text: "Quer", 79 108 color: redColor, 80 109 font: { -
mariadb-health-checks/trunk/languages/es_ES.po
r2892479 r2926579 109 109 msgstr "" 110 110 111 #: templates/admin/main-data.php:3112 msgid "In the graph you can see, in blue, the average execution time per hour of the queries of your site. In red, you can see the number of queries that have been executed."113 msgstr ""114 115 111 #: templates/admin/main-data.php:4 116 112 msgid "At the bottom you have the graph data in table format for a better reading." … … 127 123 #: templates/admin/main-data.php:28 128 124 msgid "Date / Time" 129 msgstr ""130 131 #: templates/admin/main-data.php:28132 msgid "Average Exection Time (μs)"133 125 msgstr "" 134 126 … … 817 809 msgid "Go to MariaDB Health Checks tool" 818 810 msgstr "" 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 -
mariadb-health-checks/trunk/languages/mariadb-health-checks.pot
r2923325 r2926579 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: MariaDB Health Checks 1. 0.3\n"5 "Project-Id-Version: MariaDB Health Checks 1.\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wordpress-mariadb-health-checks\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2023-0 3-30T10:40:29+00:00\n"12 "POT-Creation-Date: 2023-0+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.7.1\n" … … 76 76 77 77 #: templates/admin/main-data.php:3 78 msgid "In the graph you can see, in blue, the average execution time per hour of the queries of your site. In red, you can see the number of queries that have been executed."78 msgid "In the graph you can see, in blue, the average d." 79 79 msgstr "" 80 80 … … 96 96 97 97 #: templates/admin/main-data.php:28 98 msgid "Average Exection Time (μs)" 98 msgid "Queries Per Page" 99 msgstr "" 100 101 #: templates/admin/main-data.php:28 102 msgid "Average DB Time Per Page (ms)" 103 msgstr "" 104 105 #: templates/admin/main-data.php:28 106 msgid "Average DB Time Per Query (μs)" 99 107 msgstr "" 100 108 -
mariadb-health-checks/trunk/mariadb-health-checks.php
r2923325 r2926579 4 4 * Plugin URI: http://github.com/MariaDB/wordpress-mariadb-health-checks 5 5 * Description: MariaDB Health Checks 6 * Version: 1. 0.36 * Version: 1. 7 7 * Plugin Prefixes: mdbhc, Mdbhc, MDBHC 8 8 * Text Domain: mariadb-health-checks -
mariadb-health-checks/trunk/readme.txt
r2923325 r2926579 40 40 == Changelog == 41 41 42 43 44 45 46 47 48 49 42 50 = 1.0.3 = 43 51 -
mariadb-health-checks/trunk/static/table-mariadb_versions-data.sql
r2892479 r2926579 12 12 (11,'10.9','2023-08-22'), 13 13 (12,'10.10','2023-11-17'), 14 (13,'10.11','2028-02-16'); 14 (13,'10.11','2028-02-16'), 15 (14,'11.0','2024-06-06'); -
mariadb-health-checks/trunk/templates/admin/main-data.php
r2892479 r2926579 1 1 <h3><?php _e( 'MariaDB Data', 'mariadb-health-checks' ); ?></h3> 2 2 <p><?php _e( 'Here you have the information of the MariaDB queries', 'mariadb-health-checks' ); ?></p> 3 <p><?php _e( 'In the graph you can see, in blue, the average execution time per hour of the queries of your site. In red, you can see the number of queries that have been executed.', 'mariadb-health-checks' ); ?></p>3 <p><?php _e( 'In the graph you can see, in blue, the average d.', 'mariadb-health-checks' ); ?></p> 4 4 <p><?php _e( 'At the bottom you have the graph data in table format for a better reading.', 'mariadb-health-checks' ); ?></p> 5 5 … … 26 26 $executionTime = new MDBHC\ExecutionTime(); 27 27 $executionTimeAjax = new MDBHC\AdminScreen(); 28 echo '<table class="wp-list-table widefat striped table-view-list"><thead><tr><th>'. __('Date / Time', 'mariadb-health-checks') . "</th><th>". __('Average Exection Time (μs)', 'mariadb-health-checks'). '</th><th>' . __('Total Queries', 'mariadb-health-checks'). '</th></tr></thead>';28 echo '<table class="wp-list-table widefat striped table-view-list"><thead><tr><th>'. __('Date / Time', 'mariadb-health-checks') . . '</th></tr></thead>'; 29 29 echo '<tbody id="the-list">'; 30 30 $execTime = $executionTime->get_raw(); 31 31 foreach ($execTime as $value) { 32 echo '<tr class="inactive"><td>' . date("Y-m-d H:00", strtotime('-' . $value['hours-ago'] . ' hour')) . '</td><td>' . round($value['avg- seconds'] * 1000000) . '</td><td>' . round($value['queries-num']) . '</td></tr>';32 echo '<tr class="inactive"><td>' . date("Y-m-d H:00", strtotime('-' . $value['hours-ago'] . ' hour')) . '</td><td>' . round($value['avg-seconds'] * 1000000) . '</td><td>' . round($value['queries-num']) . '</td></tr>'; 33 33 } 34 34 echo '</tbody></table>'; -
mariadb-health-checks/trunk/templates/admin/main-general.php
r2892479 r2926579 71 71 _e( 'MariaDB version', 'mariadb-health-checks' ); 72 72 ?></td> 73 <td><?php echo esc_html($mdbhc_gd['version']); if( isset( $mdbhc_gd['version_comment'] ) ) { echo esc_html($mdbhc_gd['version_comment']); } ?></td>73 <td><?php echo esc_html($mdbhc_gd['version']); if( isset( $mdbhc_gd['version_comment'] ) ) { echo esc_html($mdbhc_gd['version_comment']); } ?></td> 74 74 </tr> 75 75 <?php -
mariadb-health-checks/trunk/uninstall.php
r2892479 r2926579 24 24 exit; 25 25 } 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
Note: See TracChangeset
for help on using the changeset viewer.