Opened 14 years ago
Closed 13 years ago
#5717 closed defect (bug) (invalid)
404 handling optimization
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.3.2 |
Component: | Optimization | Keywords: | needs-patch needs-testing |
Focuses: | Cc: |
Description
With permalinks enabled, requests for non-existing URL paths result in a resource intensive select. The problem is that WP::query_posts() doesn't halt execution when WP::parse_request() 404s, causing WP_Query::get_posts() to fetch the x most recent posts. More details: http://maisonbisson.com/blog/post/12035 .
The attached patch simply short-circuits WP::query_posts() if there's a 404. At rboren's suggestion, it also calls WP_Query::parse_query(), as some templates expect it to have run.
Honestly not sure if did_permalink is necessary, but the code works in my environments.
Attachments (1)
Change History (16)
#2
in reply to:
↑ 1
@
14 years ago
Replying to misterbisson:
Please ignore or delete the first attached file, 404fix.diff.txt
I'm an idiot.
Deleted. I assure you, you are not an idiot! I have met many people acting idiotic.
#7
@
14 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
I haven't invested why just yet, but this change totally and completely breaks AtomPub. I wouldn't be surprised if it broke XML-RPC too. Details:
http://intertwingly.net/projects/wordpress-atompub/report.html
http://intertwingly.net/projects/wordpress-atompub/apptestsuite.out
#10
@
14 years ago
Reverted for now. I'll probably push this to 2.6 since it seems ripe for unintended consequences.
#13
@
13 years ago
- Keywords needs-patch added; 404 optimization query_posts has-patch removed
would it be valid to merely dump the $this->posts = $wpdb->get_results($this->request); call when it's a 404?
Please ignore or delete the first attached file, 404fix.diff.txt
I'm an idiot.