Make WordPress Core

Opened 10 years ago

Closed 5 years ago

#14581 closed defect (bug) (wontfix)

No magic numbers

Reported by: ryan Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Database Keywords: has-patch dev-feedback close
Focuses: Cc:


Add defines for the numeric user_status and comment_status values.

Attachments (1)

14581.diff (41.9 KB) - added by wonderboymusic 6 years ago.

Download all attachments as: .zip

Change History (14)

#1 @McGurk
10 years ago

  • Cc jonathan.wilsson@… added

#2 @nacin
10 years ago

Looks like Ryan forgot to attach a patch here.

#3 @jane
10 years ago

  • Keywords needs-patch added

If someone wants to get this in for 3.1, please post a patch now, as freeze is right around the corner.

#4 @ryan
10 years ago

  • Milestone changed from 3.1 to Future Release

#5 @nacin
7 years ago

  • Component changed from General to Database

6 years ago

#6 @wonderboymusic
6 years ago

  • Keywords has-patch dev-feedback added; needs-patch removed
  • Milestone changed from Future Release to 4.0

There are magic numbers EVERYWHERE - but mainly, comments and multisite. 14581.diff replace thems throughout core with constants: WP_STATUS_ON and WP_STATUS_OFF. Also, it prepares a bunch of SQL queries instead of hard-coding '0' and '1' in them

#7 @DrewAPicture
6 years ago

As discussed elsewhere with @wonderboymusic, I could definitely see simplifying with something like this, though we'll need to be careful with the verbiage of whatever term we use for "on" and "off".

Perhaps something more like *_ENABLED|DISABLED", or *_TRUE|FALSE`.

#8 @nacin
6 years ago

I don't love this, to be honest.

#9 @wonderboymusic
6 years ago

yeah, it's weird

#10 @kitchin
6 years ago

Note you left single quotes on comment_date_gmt < '%s'" in wp-includes/comment.php line 1093 (scroll to the right to see it):

$sql = $wpdb->prepare(
	"SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = 0 AND comment_approved = %s AND comment_date_gmt < '%s'" . $comtypewhere,

Also, . $comtypewhere (scroll right further) is confusing within a format string, but I guess that's out of scope of this bug.

#11 @wonderboymusic
6 years ago

  • Milestone changed from 4.0 to Future Release

Maybe never

#12 @chriscct7
5 years ago

  • Keywords close added

#13 @johnbillion
5 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed


Note: See TracTickets for help on using tickets.