Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#18910 closed enhancement (wontfix)

get_blog_details query alteration for root-relative url plugin support...

Reported by: marcuspope's profile MarcusPope Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: Multisite Keywords: reporter-feedback
Focuses: Cc:

Description

After reading through this ticket http://core.trac.wordpress.org/ticket/17048 and all of its referenced links / discussions I decided to write my own plugin to do root-relative urls.

However there is a core issue that prevents such a plugin from working when using path-based MU installs (versus subdomain installations where as it stands cannot support root relative urls... yet.)

Looks like the logic for path-based site detection was copied wholesale from the subdomain-based detection logic in the if-block just below it.

I don't see a need to query both the path and the domain if the domain isn't going to change for a MU path-based install. This fix proposes checking explicitly for is_subdomain_install == false and then only querying the database on the path column.

If this patch doesn't account for some scenario in which path-based installs could actually have multiple domain addresses in the database then please add a filter to the $fields variable so that a plugin can handle the variance there.

I'm not here to start a root-relative vs absolute uri debate (I'm saving that for another day ;) But basically the recommendation from the WP Core team is to do this in a plugin, yet we can't until this is fixed.

Thanks!
-Marcus

(ps - if you'd like to have the absolute uri / relative root debate I'm totally game! just email me :D)

Attachments (1)

ms-blogs.php.patch (1.3 KB) - added by MarcusPope 12 years ago.
Patch for get_blog_details function

Download all attachments as: .zip

Change History (7)

@MarcusPope
12 years ago

Patch for get_blog_details function

#1 @ryan
12 years ago

Multi-network setups and the domain mapping plugins might be impacted since they allow multiple domains.

#2 @MarcusPope
12 years ago

aha, so there are plugins that allow for multiple domains to point to the same path (if I understand you correctly) which would definitely cause problems if we're not also querying on the domain column. Yeah, that would be another consequence of absolute uri's... oh well, it was purely to broaden support for this plugin

http://wordpress.org/extend/plugins/root-relative-urls/

And leaving it up to developers to patch a core file for a unique circumstance is fine by me, they can be the judge of which method to use - root relative or multi-db-record absolute urls.

Thanks for at least clarifying my concern in the original ticket! I'll update the documentation on my plugin soon.

#3 @nacin
12 years ago

Is the blog_details filter enough to do what you want to achieve without a core hack?

#4 @MarcusPope
12 years ago

Unfortunately no because the filter isn't applied when the domain name in the database doesn't match the http_host. I did mention that as an alternative solution, I could patch one up if you like.

Last edited 12 years ago by MarcusPope (previous) (diff)

#5 follow-up: @jeremyfelt
11 years ago

  • Keywords reporter-feedback added; has-patch removed
  • Milestone changed from Awaiting Review to 3.7

Is there still a desire for a filter here? It sounds like the original approach would cause issues with multi domain plugins.

#6 in reply to: ↑ 5 @nacin
11 years ago

  • Milestone 3.7 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Replying to jeremyfelt:

It sounds like the original approach would cause issues with multi domain plugins.

Yep. Eventually we remove the subdomain vs subdirectory distinction as well. This function appears too low-level for this kind of filter. I suspect a filter should be requested higher up the stack.

Note: See TracTickets for help on using tickets.