[wp-hackers] Force a new ABSPATH when moving WordPress?

Chris Williams chris at clwill.com
Thu Mar 22 00:54:40 UTC 2012


As has been discussed 100,000 times on this list, do not underestimate the
complexity of #1.  You can't just change a couple of database entries for
home and base URL.  There are many instances, including all the images and
other media in attachments.

But the most complicated part is in the serialized data in things like
user settings.  As someone recently pointed out, if you blindly do a
search/replace in the serialized data, you mess up the serialized format
(which includes string length).  The only safe way to do that is to spin
through all the data, unserialize things, search/replace the URLs, then
reserialize it and save it back.

In all, it's not for the faint of heart.

On 3/21/12 1:19 PM, "onlyunusedname" <onlyunusedname at gmail.com> wrote:

>Excellent.  Thanks, Otto.  There is eAccelerator running on this server
>and
>clearing its cache is just the trick.
>
>Just out of curiosity:  If one wanted to write a script that did
>everything
>in a more environment agnostic fashion, would that be possible?
>
>In other words, this script would run once after a URI change and it
>would:
>
>1) Change the relevant database entries from $old_url to $new_url.
>
>2)  [Magically solve a cached ABSPATH problem in a reasonably environment
>agnostic fashion]
>
>3) Redirect to $new_url  (Site successfully moved.)
>
>
>Is step 2 as preposterous as I am making it sound, or can you imagine a
>feasable-ish answer?
>
>Thanks in any event.  You helped me a ton.



More information about the wp-hackers mailing list