Jump to:
| Project: | Path redirect |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Dave Reid |
| Status: | closed (fixed) |
| Issue tags: | 6.x-1.0 blocker, Needs architectural review |
Issue Summary
Currently in path_redirect_check(), we first match a redirect by the current path with query string. If a match was not found, then we search by just the current path without the query string. The majority of redirects that users have do not involve redirects, so this creates an extra query for every hook_init() call. For a large site with a large number of redirects, this could be optimized to match just by the path alone first, then path with the query string.
This will also allow us to use the prepared $_GET['q'] variable since it just contains the path element instead of finagling with request_uri(). This will also have slight performance increase for large sites on every hook_init() call.
I'm looking into implementing this change. As a part of this, the current path field in {path_redirect} will need to be split into two fields, a path and a path_query field. As a part of this split, I'd like to do a clean-up on the current field names since we'll now have two query fields. The proposed changes to {path_redirect} table fields are as follows:
path -> src and src_query
redirect -> dst
query -> dst_query
fragment -> dst_fragment
Now we'd be using 'src' and 'dst' just like {url_alias}, will be a little easier to understand, and should be fairly future-proof.
Comments
#1
Note that src should be 'source' and 'dst' should be 'redirect'
#2
Adding release blocker tag.
#3
What's been finished:
- Renamed 'path' field to 'source' (matches D7 style naming with {url_alias}
- The when redirects are loaded the code split the query part of source into source_query as an array
- We can now do awesome patch matching using $_GET and source_array using path_redirect_compare_array() which performs a recursive check to make sure all the elements of source_array are found in $_GET.
Todo:
- #648604: Split out a source_query field from {path_redirect}.source
- #646950: Add an option to store redirects as menu router items instead of using hook_init()
#4
No more changes to path matching being made at this point.
#5
Automatically closed -- issue fixed for 2 weeks with no activity.