Jump to content

Cre8asiteforums Internet Marketing
and Conversion Web Design


Photo

Questions About Editing Wp Database Backups


  • Please log in to reply
3 replies to this topic

#1 AbleReach

AbleReach

    Peacekeeper Administrator

  • Admin - Top Level
  • 6457 posts

Posted 10 October 2007 - 06:05 PM

I need to change the links on a couple of 100+ page sites to reflect a new domain name. One is a static site that I am moving into Wordpress. One is already in Wordpress. The links in question are within the body of posts and pages. Most of the changed links are different because the site is being restructured or because of where the images in the posts are being stored. In one case, the old static site has images directories that can't exist in the new site, because WP needs the directory names for permalinks. Also, one of the old sites uses a base URL, which won't be the case in WP.

For some of the changes I've been editing the WP database backup with a text editor, so that I only have to open one file and can do more at once. I do an extended search, and then paste in the updated URL. So far, so good, as far as results go. I can see what I am doing, and I don't find out that I've replaced something I shouldn't have after the fact, because though I'm doing an extended search I'm not doing an extended search *and*replace.* At this size, the time lost due to not doing the "and replace" part is just barely still OK.

However, it feels a little like when I started playing with html, and clipping the end of one table tag had the potential to make the whole house of cards come down. If I knew what to look for, a clipped tag was just a clipped tag. If not, disaster.

What do I need to look out for, and what would be good to learn next?

Edited by AbleReach, 10 October 2007 - 06:07 PM.


#2 Guest_Autocrat_*

Guest_Autocrat_*
  • Guests

Posted 10 October 2007 - 06:45 PM

Well, I'm not a WP user... but I assume that the URL's are stored ia certain fasshion... either as a straight address, or as a link tag set, possibly with entity coded characters.

So... can you find the address you want to replace?
If so, are you not able to simple search for that and replace it?

Further... you are editing a copy of he DB... so you should still ahvea safe copy incase you make a little error here or there?
Thats somethig I love... in less than 1 minute I can ruin and entire site... and in two more I can have it back up and running!


so either you're looking for;
http://www.thissite....ex.php/whatever
http://thissite.wht/index.php/whatever
www.thissite.wht/index.php/whatever
index.php/whatever
/whatever

Any of those... or....
<a href="oneoftheabove" title="doesthisneedstochangetoo">whataboutthis</a>
or the above with thigs like &lt; etc.

???


Does that help at all - or have I just show something with eggs?

#3 AbleReach

AbleReach

    Peacekeeper Administrator

  • Admin - Top Level
  • 6457 posts

Posted 10 October 2007 - 08:56 PM

Further... you are editing a copy of he DB... so you should still ahvea safe copy incase you make a little error here or there?
Thats somethig I love... in less than 1 minute I can ruin and entire site... and in two more I can have it back up and running!

LOL
Same here - 'tis a strange magick, and you described what I am doing very well.

In the table `wp_posts` the text of each post is stored, with bits before and after that say something like this for the URI http://mysite.com/perma/link/pagename, with the title of "PageTitle" and the file name of "pagename"

INSERT INTO `wp_posts` VALUES (12, 1, '2007-09-22 03:41:56', '2007-09-22 07:41:56', 'This is the first text of the post.  Here is a link <a href="http://mysite.com/something/">to mysitee</a>.\r\n\r\nHere is another paragraph.\r\n\r\n<h3>What/s My Line?</h3>Another line or two here ends this post.', 'PageTitle', 0, '', 'publish', 'open', 'closed', '', 'pagename', '', '', '2007-10-08 07:29:00', '2007-10-08 11:29:00', '', 0, 'http://mysite.com/perma/link/pagename', 20, 'page', '', 0);

What's making me nervous is the possibility of blythly replacing a few instances of http://mysite.com/perma/link/pagename because they happen to match the link I need to change within the post. And, that led me to wonder what would happen if I accidentally clip something and create some other inconsistency or other in the information before and after the post content. Accidents happen!

Because I'm being careful and going link by link, I think I'm OK, for my current needs, but it'd be a good thing to learn enough to be confident about detecting and fixing accidents.

I don't mind messing around with small parts without knowing how the whole thing works, but I do insist on knowing I'm not doing harm. It's sort of like knowing to keep oil in a car and being aware of when an engine sounds/smells like the crank case is dry, without knowing how to rebuild an engine myself. Anyone who drives a car that burns oil should know how problems sound and smell, as well as know checking their oil and following through, though they may get by for a while without that insight.

Edited by AbleReach, 10 October 2007 - 08:57 PM.


#4 Guest_Autocrat_*

Guest_Autocrat_*
  • Guests

Posted 11 October 2007 - 10:22 AM

Okay... do you have the facility to convert the file?

If you havethe entire DB... you may want to break it down into module chunks or at least the content chunks.
Then you could translate it into a spreadsheet.

I use NaviCat... as I'm not a programmer and don't claim to be... I'm more than comfortable usig the equivelent of a DB WYSIWYG interface...
From that I can connect to a DB... view individual tables... and either export the entire table into different formats... or just parts of the data.


There is a free trial downlaod more often than not... so I'd recommed getting it... then exporting the data into a more "manageable" format to play with.... as you should end up with a spreadsheet (if you go for the Excel option), with a column for the relevant parts.

Much easier :D

[EDIT]

http://www.navicat.com/download.html
Now even Easier :D

Edited by Autocrat, 11 October 2007 - 10:23 AM.




RSS Feed

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users