Make WordPress Core

Opened 21 years ago

Closed 19 years ago

Last modified 10 years ago

#2134 closed enhancement (fixed)

consolidating get_userdata() and get_userdatabylogin()

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

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 21 years ago.
2134.diff​ (1.4 KB ) - added by westi 19 years ago.
Patched refreshed to apply to current trunk
2134.002.diff​ (1.4 KB ) - added by markjaquith 19 years ago.

Download all attachments as: .zip

Change History (13)

#1 @johnjosephbachir
21 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
21 years ago

  • Milestone 2.0 → 2.1

#3 @Nazgul
20 years ago

  • Keywords has-patch added

#4 @matt
20 years ago

  • Milestone 2.1 → 2.2

#5 @foolswisdom
20 years ago

  • Milestone 2.2 → 2.3

@westi
19 years ago

Patched refreshed to apply to current trunk

#6 @westi
19 years ago

  • Keywords needs-testing added
  • Owner changed from anonymous to westi
  • Status new → 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
19 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
19 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
19 years ago

  • Resolution → fixed
  • Status assigned → 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.


10 years ago

Note: See TracTickets for help on using tickets.