Skip to:
Content

Opened 2 years ago

Closed 2 years ago

#6976 closed enhancement (fixed)

bp_core_print_generation_time() should echo only in WP_DEBUG mode

Reported by: slaFFik Owned by: boonebgorges
Milestone: 2.6 Priority: normal
Severity: normal Version: 1.0
Component: Core Keywords: has-patch
Cc:

Description

Currently bp_core_print_generation_time() prints info like this:

<!-- Generated in 0,608 seconds. (103 q) -->

on every page load.

I believe, that's quite sensitive information, and should NOT be printed in normal mode.

WP_DEBUG is more appropriate situation.

Also, I think we need to increase the $priority to something like 9999 or bigger, as wp_footer is rather popular action.

Attachments (1)

6976.patch (756 bytes) - added by slaFFik 2 years ago.

Download all attachments as: .zip

Change History (12)

#1 @DJPaul
2 years ago

Nah, let's just kill it. It's so old it was probably used as a way of measuring performance during initial development.

#2 @slaFFik
2 years ago

There IS a difference in data, when we have 9999 priority (both in queries and seconds). Between 10 and 9999 - 8 queries, 10 and 99999 - 10 queries.

And I do want to preserve it :) So can I submit a patch that will preserve it and display in DEBUG mode only?

Last edited 2 years ago by slaFFik (previous) (diff)

#3 @slaFFik
2 years ago

  • Version set to 1.0

Better submit than not :)

Last edited 2 years ago by slaFFik (previous) (diff)

@slaFFik
2 years ago

#4 @slaFFik
2 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 2.6

#5 @slaFFik
2 years ago

  • Owner set to slaFFik
  • Status changed from new to assigned

This ticket was mentioned in Slack in #buddypress by boone. View the logs.


2 years ago

This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.


2 years ago

#8 @DJPaul
2 years ago

Let's decide in dev chat whether to keep this with slaFFik's patch or just remove it entirely (my preference).

#9 @boonebgorges
2 years ago

  • Owner changed from slaFFik to boonebgorges
  • Status changed from assigned to accepted

Let's decide in dev chat whether to keep this with slaFFik's patch or just remove it entirely (my preference).

Let's just decide now. Out it goes :)

@slaFFik - I can see why it'd be useful to have data during WP_DEBUG, but a BP core function doesn't seem like the appropriate place. A proper debugging tool should be used. May I suggest https://wordpress.org/plugins/query-monitor/ ?

#10 @slaFFik
2 years ago

And Debug Bar displays that info too (with SAVEQUERIES defined). This small comment with sec and q was used by me for 7 years, it's like an old good friend :)

But I totally understand Paul's and your idea. So just remove it completely. Perhaps this will save some CPU for servers out there :)

#11 @boonebgorges
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 10723:

Deprecate bp_core_print_generation_time().

Props slaFFik.
Fixes #6976.

Note: See TracTickets for help on using tickets.