[wp-trac] [WordPress Trac] #33871: comment_exists() results in a bad query
WordPress Trac
noreply at wordpress.org
Wed Sep 23 16:15:31 UTC 2015
#33871: comment_exists() results in a bad query
-------------------------+---------------------------
Reporter: apokalyptik | Owner: boonebgorges
Type: enhancement | Status: assigned
Priority: normal | Milestone: 4.4
Component: Comments | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses: performance
-------------------------+---------------------------
Comment (by apokalyptik):
Replying to [comment:7 boonebgorges]:
> [attachment:33871.diff] is what I have in mind. Thoughts, apokalyptik or
Viper007Bond?
If you're going to go this route I think a ternary is needlessly complex.
The following is more lines, but instantly understandable even to those
that don't think in ternary (which is many people, and so a pay-it-forward
to future maintainers). Huge +1 for tests, which are awesome!
{{{#!php
$date_field = 'comment_date';
if ( 'gmt' === $timezone ) {
$date_field = 'comment_date_gmt';
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33871#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list