Make WordPress Core

Ticket #41217: 41217.4.diff

File 41217.4.diff, 2.4 KB (added by iandunn, 9 years ago)

Remove the logs entirely, see comment:11

  • src/wp-admin/includes/class-wp-community-events.php

    diff --git src/wp-admin/includes/class-wp-community-events.php src/wp-admin/includes/class-wp-community-events.php
    index 2eda6a0834..b2b50b9d30 100644
    class WP_Community_Events { 
    9898                $response_code  = wp_remote_retrieve_response_code( $response );
    9999                $response_body  = json_decode( wp_remote_retrieve_body( $response ), true );
    100100                $response_error = null;
    101                 $debugging_info = compact( 'api_url', 'request_args', 'response_code', 'response_body' );
    102101
    103102                if ( is_wp_error( $response ) ) {
    104103                        $response_error = $response;
    class WP_Community_Events { 
    116115                }
    117116
    118117                if ( is_wp_error( $response_error ) ) {
    119                         $this->maybe_log_events_response( $response_error->get_error_message(), $debugging_info );
    120 
    121118                        return $response_error;
    122119                } else {
    123120                        $expiration = false;
    class WP_Community_Events { 
    157154                        $response_body = $this->trim_events( $response_body );
    158155                        $response_body = $this->format_event_data_time( $response_body );
    159156
    160                         // Avoid bloating the log with all the event data, but keep the count.
    161                         $debugging_info['response_body']['events'] = count( $debugging_info['response_body']['events'] ) . ' events trimmed.';
    162 
    163                         $this->maybe_log_events_response( 'Valid response received', $debugging_info );
    164 
    165157                        return $response_body;
    166158                }
    167159        }
    class WP_Community_Events { 
    414406
    415407                return $response_body;
    416408        }
    417 
    418         /**
    419          * Logs responses to Events API requests.
    420          *
    421          * All responses are logged when debugging, even if they're not WP_Errors.
    422          * Debugging info is still needed for "successful" responses, because
    423          * the API might have returned a different location than the one the user
    424          * intended to receive. In those cases, knowing the exact `request_url` is
    425          * critical.
    426          *
    427          * Errors are logged instead of being triggered, to avoid breaking the JSON
    428          * response when called from AJAX handlers and `display_errors` is enabled.
    429          *
    430          * @since 4.8.0
    431          *
    432          * @param string $message A description of what occurred.
    433          * @param array  $details Details that provide more context for the
    434          *                        log entry.
    435          */
    436         protected function maybe_log_events_response( $message, $details ) {
    437                 if ( ! WP_DEBUG_LOG ) {
    438                         return;
    439                 }
    440 
    441                 error_log( sprintf(
    442                         '%s: %s. Details: %s',
    443                         __METHOD__,
    444                         trim( $message, '.' ),
    445                         wp_json_encode( $details )
    446                 ) );
    447         }
    448409}