Make WordPress Core

Opened 19 years ago

Closed 18 years ago

Last modified 8 years ago

#2134 closed enhancement (fixed)

consolidating get_userdata() and get_userdatabylogin()

Reported by: johnjosephbachir's profile johnjosephbachir Owned by: westi's profile westi
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.0
Component: Optimization Keywords: has-patch needs-testing
Focuses: Cc:

Description

Here is a patch which consolidates logic in the two functions get_userdata() and get_userdatabylogin(). If get_userdatabylogin() does not find the user in the cache, it has get_userdata() do the rest. The number of database queries remains the same in all usage cases.

Attachments (3)

pluggable-functions.php.diff (1.8 KB) - added by johnjosephbachir 19 years ago.
2134.diff (1.4 KB) - added by westi 18 years ago.
Patched refreshed to apply to current trunk
2134.002.diff (1.4 KB) - added by markjaquith 18 years ago.

Download all attachments as: .zip

Change History (13)

#1 @johnjosephbachir
19 years ago

NOTE: I didn't indent the code inside the if that I added to get_userdata, so that the diff would be easier to read.

#2 @ryan
19 years ago

  • Milestone changed from 2.0 to 2.1

#3 @Nazgul
19 years ago

  • Keywords has-patch added

#4 @matt
18 years ago

  • Milestone changed from 2.1 to 2.2

#5 @foolswisdom
18 years ago

  • Milestone changed from 2.2 to 2.3

@westi
18 years ago

Patched refreshed to apply to current trunk

#6 @westi
18 years ago

  • Keywords needs-testing added
  • Owner changed from anonymous to westi
  • Status changed from new to assigned

I have refreshed the patch to apply to trunk.

The new patch also no longer changes the prototype of any of the functions in pluggable.php.

#7 follow-up: @markjaquith
18 years ago

Only change I would make is to change that SQL query so that it only grabs the ID, not the whole row. See patch.

#8 in reply to: ↑ 7 @westi
18 years ago

Replying to markjaquith:

Only change I would make is to change that SQL query so that it only grabs the ID, not the whole row. See patch.

Yeah makes sense. When updating the patch I stared at the code in wp-db.php but could work out which function I should be using.

#9 @westi
18 years ago

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

(In [6094]) Consolidate shared code in get_userdata and get_userdatabylogin. Fixes #2134 props johnjosephbachir

This ticket was mentioned in Slack in #forums by t-p. View the logs.


8 years ago

Note: See TracTickets for help on using tickets.