Plugin Directory

Changeset 2926579

Timestamp:
06/15/2023 12:41:12 PM (14 months ago)
Author:
l1nuxjedi
Message:

Release 1.1.0

Location:
mariadb-health-checks
Files:
68 added
13 edited

Legend:

Unmodified
Added
Removed
  • mariadb-health-checks/trunk/inc/App/ExecutionTime.php

    r2907902 r2926579  
    1212        global $wpdb;
    1313
    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            }
    2638        }
    2739    }
     
    2941    public function get() {
    3042        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;";
    3244        $resultsDb = $wpdb->get_results($query, ARRAY_A);
    3345        $results   = [];
     
    3850            $results[$k]['microseconds'] = $r['avg-seconds'] * 1000000;
    3951            $results[$k]['queries-num']  = $r['queries-num'];
     52
     53
    4054        }
    4155
     
    4660    {
    4761        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;";
    4963        return $wpdb->get_results( $query, ARRAY_A );
    5064    }
  • mariadb-health-checks/trunk/inc/App/GeneralData.php

    r2923325 r2926579  
    22/**
    33 * @package MariaDB_Health_Checks
    4  * @version 1.0.3
     4 * @version 1.
    55 */
    66
  • mariadb-health-checks/trunk/inc/functions.php

    r2892479 r2926579  
    7373    global $wpdb;
    7474
    75     return $wpdb->get_var( "SELECT VERSION();" );
     75    return $wpdb->get_var( "SELECT V;" );
    7676}
    7777
  • mariadb-health-checks/trunk/inc/hooks.php

    r2907902 r2926579  
    3838}
    3939
    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
     41if ( !defined( 'SAVEQUERIES' ) || !SAVEQUERIES ) {
     42    $tmp = new MDB_DB(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
     43    $tmp->loadFromParentObj($wpdb);
     44    $wpdb = $tmp;
     45}
    4346
    4447function mdbhc_save_average_query_execution_time()
  • mariadb-health-checks/trunk/js/scripts.js

    r2892479 r2926579  
    1010                const execTime = [];
    1111                const averageQueries = [];
     12
     13
     14
     15
     16
    1217
    1318                response.data.forEach((res, i) => {
     
    1520                    var time_vals = {x: res.date * 1000, y: Math.round(res.microseconds)};
    1621                    var query_vals = {x: res.date * 1000, y: res["queries-num"]};
     22
     23
    1724                    execTime.push(time_vals);
    1825                    averageQueries.push(query_vals);
     26
     27
    1928                });
    2029
    2130                var datasets = [
    2231                    {
    23                         label: "Average execution time in μS",
    24                         data: execTime,
     32                        label: "Average ",
     33                        data: e,
    2534                        borderWidth: 1,
    2635                        yAxisID: "y",
    2736                    },
    2837                    {
    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",
    3052                        data: averageQueries,
    3153                        borderWidth: 1,
    3254                        yAxisID: "y1",
    33                     }
     55                        hidden: true
     56                    },
     57
     58
    3459                ];
    3560
     
    4671                    datasets[1].borderWidth = 3;
    4772                    datasets[1].borderColor = redColor;
     73
     74
     75
     76
    4877                }
    4978
     
    6089                                title: {
    6190                                    display: true,
    62                                     text: "Execution time",
     91                                    text: " time",
    6392                                    color: blueColor,
    6493                                    font: {
     
    76105                                title: {
    77106                                    display: true,
    78                                     text: "Queries",
     107                                    text: "Quer",
    79108                                    color: redColor,
    80109                                    font: {
  • mariadb-health-checks/trunk/languages/es_ES.po

    r2892479 r2926579  
    109109msgstr ""
    110110
    111 #: templates/admin/main-data.php:3
    112 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 
    115111#: templates/admin/main-data.php:4
    116112msgid "At the bottom you have the graph data in table format for a better reading."
     
    127123#: templates/admin/main-data.php:28
    128124msgid "Date / Time"
    129 msgstr ""
    130 
    131 #: templates/admin/main-data.php:28
    132 msgid "Average Exection Time (μs)"
    133125msgstr ""
    134126
     
    817809msgid "Go to MariaDB Health Checks tool"
    818810msgstr ""
     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  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: MariaDB Health Checks 1.0.3\n"
     5"Project-Id-Version: MariaDB Health Checks 1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wordpress-mariadb-health-checks\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2023-03-30T10:40:29+00:00\n"
     12"POT-Creation-Date: 2023-0+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.7.1\n"
     
    7676
    7777#: 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."
     78msgid "In the graph you can see, in blue, the average d."
    7979msgstr ""
    8080
     
    9696
    9797#: templates/admin/main-data.php:28
    98 msgid "Average Exection Time (μs)"
     98msgid "Queries Per Page"
     99msgstr ""
     100
     101#: templates/admin/main-data.php:28
     102msgid "Average DB Time Per Page (ms)"
     103msgstr ""
     104
     105#: templates/admin/main-data.php:28
     106msgid "Average DB Time Per Query (μs)"
    99107msgstr ""
    100108
  • mariadb-health-checks/trunk/mariadb-health-checks.php

    r2923325 r2926579  
    44 * Plugin URI: http://github.com/MariaDB/wordpress-mariadb-health-checks
    55 * Description: MariaDB Health Checks
    6  * Version: 1.0.3
     6 * Version: 1.
    77 * Plugin Prefixes: mdbhc, Mdbhc, MDBHC
    88 * Text Domain: mariadb-health-checks
  • mariadb-health-checks/trunk/readme.txt

    r2923325 r2926579  
    4040== Changelog ==
    4141
     42
     43
     44
     45
     46
     47
     48
     49
    4250= 1.0.3 =
    4351
  • mariadb-health-checks/trunk/static/table-mariadb_versions-data.sql

    r2892479 r2926579  
    1212(11,'10.9','2023-08-22'),
    1313(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  
    11<h3><?php _e( 'MariaDB Data', 'mariadb-health-checks' ); ?></h3>
    22<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>
    44<p><?php _e( 'At the bottom you have the graph data in table format for a better reading.', 'mariadb-health-checks' ); ?></p>
    55
     
    2626    $executionTime = new MDBHC\ExecutionTime();
    2727    $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>';
    2929    echo '<tbody id="the-list">';
    3030  $execTime = $executionTime->get_raw();
    3131  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>';
    3333  }
    3434    echo '</tbody></table>';
  • mariadb-health-checks/trunk/templates/admin/main-general.php

    r2892479 r2926579  
    7171                _e( 'MariaDB version', 'mariadb-health-checks' );
    7272            ?></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>
    7474        </tr>
    7575    <?php
  • mariadb-health-checks/trunk/uninstall.php

    r2892479 r2926579  
    2424    exit;
    2525}
     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.