Make WordPress Core

Ticket #42151: 42151.7.diff

File 42151.7.diff, 2.6 KB (added by pento, 5 years ago)
  • src/wp-includes/wp-db.php

    diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php
    index f1fd1c297f..ea9b9c21b3 100644
    a b class wpdb { 
    180180         * @since 1.5.0
    181181         * @since 2.5.0 The third element in each query log was added to record the calling functions.
    182182         * @since 5.1.0 The fourth element in each query log was added to record the start time.
     183         * @since 5.3.0 The fifth element in each query log was added to record custom data.
    183184         *
    184185         * @var array[] {
    185186         *     Array of queries that were executed.
    class wpdb { 
    191192         *         @type float  $1 Total time spent on the query, in seconds.
    192193         *         @type string $2 Comma separated list of the calling functions.
    193194         *         @type float  $3 Unix timestamp of the time at the start of the query.
     195         *         @type array  $4 Custom query data.
    194196         *     }
    195197         * }
    196198         */
    class wpdb { 
    20142016                $this->num_queries++;
    20152017
    20162018                if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
    2017                         $this->queries[] = array(
    2018                                 $query,
    2019                                 $this->timer_stop(),
    2020                                 $this->get_caller(),
    2021                                 $this->time_start,
     2019                        $this->log_query(
     2020                                array(
     2021                                        $query,
     2022                                        $this->timer_stop(),
     2023                                        $this->get_caller(),
     2024                                        array(),
     2025                                )
    20222026                        );
    20232027                }
    20242028        }
    20252029
     2030        /**
     2031         * Logs query data.
     2032         *
     2033         * @since 5.3.0
     2034         *
     2035         * @param array $query_data {
     2036         *     Data for the query.
     2037         *
     2038         *     @type string $0 The query's SQL.
     2039         *     @type float  $1 Total time spent on the query, in seconds.
     2040         *     @type string $2 Comma separated list of the calling functions.
     2041         *     @type float  $3 Unix timestamp of the time at the start of the query.
     2042         *     @type array  $4 Custom query data.
     2043         * }
     2044         */
     2045        public function log_query( $query_data ) {
     2046                /**
     2047                 * Filters the query data being logged.
     2048                 *
     2049                 * Caution should be used when modifying any of this data, it is recommended that any additional
     2050                 * information you need to store about a query be added as a new associative entry to the fourth
     2051                 * element $query_data.
     2052                 *
     2053                 * @since 5.3.0
     2054                 *
     2055                 * @param array $query_data {
     2056                 *     Data for the query.
     2057                 *
     2058                 *     @type string $0 The query's SQL.
     2059                 *     @type float  $1 Total time spent on the query, in seconds.
     2060                 *     @type string $2 Comma separated list of the calling functions.
     2061                 *     @type float  $3 Unix timestamp of the time at the start of the query.
     2062                 *     @type array  $4 Custom query data.
     2063                 * }
     2064                 */
     2065                $this->queries[] = apply_filters( 'log_query_data', $query_data );
     2066        }
     2067
    20262068        /**
    20272069         * Generates and returns a placeholder escape string for use in queries returned by ::prepare().
    20282070         *