Opened 7 years ago
Closed 7 years ago
#42073 closed defect (bug) (fixed)
Add limit 1 to get_blog_id_from_url
Reported by: | spacedmonkey | Owned by: | jeremyfelt |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.6 |
Component: | Networks and Sites | Keywords: | has-patch good-first-bug |
Focuses: | multisite | Cc: |
Description
get_blog_id_from_url
uses to get_sites
to looks if site exists. But it only uses the first result. The param limit should be added to get_sites, limiting the query.
Attachments (2)
Change History (9)
#1
@
7 years ago
- Keywords has-patch added; needs-patch removed
In 42073.diff, limits the query to get the first result from get_sites()
.
#2
@
7 years ago
We should consider simplifying the function further, by internally using the new get_site_by()
. See https://core.trac.wordpress.org/ticket/40180#comment:24
- The advantage would be less code to maintain, and we could theoretically even deprecate this function at some point (not a necessity though).
- The disadvantage would be that
get_site_by()
returns a full object, while we only need an ID here. Not sure that's a real issue though, since it only queries for one result anyway, so it shouldn't have a significant impact on performance.
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
7 years ago
#4
@
7 years ago
- Owner set to jeremyfelt
- Status changed from new to reviewing
42073.2.diff uses get_site_by()
and removes tests for blog-id-cache
. If we go this route, we'll be able to remove blog-id-cache
from a handful of other places as well.
Note: See
TracTickets for help on using
tickets.
Adds number parameter to limit by 1