Opened 9 years ago
Closed 9 years ago
#42073 closed defect (bug) (fixed)
Add limit 1 to get_blog_id_from_url
| Reported by: | spacedmonkey | Owned by: | jeremyfelt |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.9 |
| Component: | Networks and Sites | Version: | 4.6 |
| Severity: | normal | Keywords: | has-patch good-first-bug |
| Cc: | Focuses: | multisite |
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
@
9 years ago
- Keywords has-patch added; needs-patch removed
In 42073.diff, limits the query to get the first result from get_sites().
#2
@
9 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.
9 years ago
#4
@
9 years ago
- Owner set to
- Status new → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Adds number parameter to limit by 1