Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-04-02 16:56:57
- tassoman
- Member
- Registered: 2006-03-31
- Posts: 13
Wordpress import script improved
Hi to all,
after some discussions between the txp staff and me, about utf-8 usage and iso-8859-1 conversion, I’ve discovered the WordPress import script seems a bit aged, or simply rought written.
So I’ve edited it and improved.
- utf-8 charset conversion (from server’s default php charset configured)
- Added support for Excerpt
- switched some addslashes to mysql_escape_string
You can find the code at pastebin: http://pastebin.com/636089
The only thing isn’t clear to me is that: The raw article’s text contains html tags. It should contain textile symbols.
So raw text isn’t textilezed but same as the output.
Last edited by tassoman (2006-04-02 17:04:57)
Offline
#2 2006-04-03 00:44:01
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Wordpress import script improved
T,
Thanks for this. What we really need is, some sample WordPress data to help test it. Can you (or anyone else) help out?
Alex
Offline
#3 2006-04-03 07:09:37
- tassoman
- Member
- Registered: 2006-03-31
- Posts: 13
Re: Wordpress import script improved
I could setup a sample blog and writedown some stuff in italian lang, then mysqldump and pastebin if you want.
BTW yesterday evening i was trying to set mine personal rewriterule based on post-id and post-nice-title:
- RedirectMatch permanent /([0-9]{1,3}),(.*)$ http://www.tassoman.com/blog/$1/$2
But I saw the post ID wasn’t imported and were different into the textpattern table. So I think that for a fully working, easy migration, is needed a textpattern empty installation, and importing data with correct IDs.
Last edited by tassoman (2006-04-03 07:11:04)
Offline
#4 2006-04-03 08:00:32
- tassoman
- Member
- Registered: 2006-03-31
- Posts: 13
Re: Wordpress import script improved
Ok this is the new code ( http://pastebin.com/637232 ), updated with IDs from WP, please keep attention I’ve added queries to EMPTY the data tables before import, so this script should used only to duplicate an other blog, and not to integrate anything.
So now I pass the ball to staff. There’s a choice to do: keep script erasing tables, or to add an option asking if we want to takeover or add the wp posts.
This should be an interface option where we insert database data and wp_ table prefix.
Then you could add the source charset option, mb_convert_charset by default uses the php setting, but you could assign one of your choice ( please read manual for this: http://it.php.net/mb_convert_encoding ). So this could be another choice to add in the import interface.
Last edited by tassoman (2006-04-03 08:01:12)
Offline
#5 2006-04-05 21:59:05
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Wordpress import script improved
I could setup a sample blog and writedown some stuff in italian lang, then mysqldump and pastebin if you want.
That would be perfect. Even just a handful of short articles would help – some with html and entities, some without, plus anything else you’re aware of that Wordpress might throw at us.
There’s a choice to do: keep script erasing tables, or to add an option asking if we want to takeover or add the wp posts.
I don’t think erasing first is a good idea. Better to copy the existing IDs if they’re not already in use, create new ones if not.
Alex
Offline
#6 2006-04-06 11:25:29
- tassoman
- Member
- Registered: 2006-03-31
- Posts: 13
Re: Wordpress import script improved
you see if anyone has set his wordpress to give out as url www.myoldwpblog.tld/1/the-title, giving different IDs will break url rewriting.
But if URL is based on date (as www.myoldwpblogwithdates.tld/2006/12/08/the-title) all still right, and posts ID aren’t needed.
Offline
#7 2006-04-08 00:56:35
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Wordpress import script improved
Sure, I understand the need for keeping post IDs the same. But I don’t think “erase everything” is an appropriate first step for an importer.
BTW: neither of those pastebin links work for me.
Last edited by zem (2006-04-08 01:42:13)
Alex
Offline
#8 2006-04-08 08:09:18
- tassoman
- Member
- Registered: 2006-03-31
- Posts: 13
Re: Wordpress import script improved
I’m going to send an email direct to you with code.
Offline
Re: Wordpress import script improved
I have a backed up wordpress database. It’s small with many of the things you’re looking for. Where do I send it Zem?
“I was born to hustle roses down the avenues of the dead.” – Charles Bukowski
The Human Museum
Offline
#10 2006-04-09 22:01:31
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Wordpress import script improved
You can send me an email via the link to the left.
Alex
Offline
Re: Wordpress import script improved
I get an empty textarea field when I go to the URL where the import script code is supposed to be: http://pastebin.com/637232.
Any other pointers to the code?
Richard
richard at the domain blumberg.org
Offline
Pages: 1