[wp-hackers] Why WP_SITEURL and not $_SERVER['HTTP_HOST']?

Mike Schinkel mikeschinkel at newclarity.net
Tue Mar 30 21:40:51 UTC 2010


On Mar 30, 2010, at 12:50 PM, Otto wrote:
> The RELOCATE define does much the same thing, no?
> 
> http://codex.wordpress.org/Changing_The_Site_URL#Relocate_method
> 

Thanks.  

I found the RELOCATE after emailing the question and explored it.  Seems it only works for the wp-login.php page.  It also seems (in a good way) like it started to address this issue in a first step kind of way. The next step might be to add a 'relocate' hook to run when that flag is detected, assuming that is the right place for it (as I've not tried it yet I can't be sure.)

Another thing is RELOCATE being in wp-login.php doesn't address taking the site offline until everything has been fixed-up.

On Mar 30, 2010, at 12:44 PM, scribu wrote:
> On Tue, Mar 30, 2010 at 1:37 PM, Mike Schinkel
> <mikeschinkel at newclarity.net>wrote:
>> I want to create a plugin that will automate this process as much as
>> possible so I can not longer have to worry about setting things "just right"
>> and no longer have to worry that I forgot to make that one critical change.
>> Better yet, I'd like to enable plugin and theme developers to make handle
>> this process for their plugins and themes for me.
>> 
> 
> Looks like there's a plugin for this already:
> 
> http://wordpress.org/extend/plugins/ezmigrate/

VERY interesting.  Thanks for this link.  I will definitely check out it's code because it's not quite what I'm trying to do though it's close.

A couple concerns about it:
=============
When a post is saved into the database it replaces all root urls in href and src attributes with a placeholder. (This is also done for all posts when the plugin is activated).
When a post is retrieved from the database it replaces all placeholders with the current calculated root url. (This is also done for all posts when the plugin is deactivated).
What this plugin doesn’t do (but might do in the future):
Replace urls outside of the four mentioned options or outside of href and src attributes in posts. But so far it has been sufficient for my projects.
=============

So I tend to agree with what Otto has said[1] about having HTML in the database and not placeholders.

But the latter part is the most troubling. What's needed IMO is a hookable system that allows any plugin developer to add support for domain migration, and for any PHP developer to add the needed support for any plugins that don't have the support. THAT is the primary thing I'm trying to accomplish because the core stuff is relatively easy, and ideally the hook(s) would get rolled into core just like RELOCATE is in core.

Now maybe the authors of the plugin will add that kind of support in which case my primary concern would be moot.  We'll see.
-Mike

[1] http://core.trac.wordpress.org/ticket/11394#comment:29


More information about the wp-hackers mailing list