Migrate special category of entries to new blog

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
tazilein
Regular
Posts: 56
Joined: Sun Apr 30, 2006 11:44 pm
Contact:

Migrate special category of entries to new blog

Post by tazilein »

Mea culpa that I allways have so many questions ...

I use s9y as cms for a website and used a category with a special theme as "blog". No I installed a second copy of s9y on that webspace to have full control over the blog and the main site uses still the other s9y-installation as cms.

I would like to export the entries of that "blog" category from the old one and import it to the new one. How can this be done best?
my S9Y-Blogs: my personal brainbackup | [url=http://www.viennacityflats,at]Vienna Apartments Rental[/url] | Kasperls Geschichten | various other Sites using S9y as CMS
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Migrate special category of entries to new blog

Post by garvinhicking »

Hi!

Usually you achieve that through SQL export dumps, by using phpMyAdmin to export the entries of your serendipity_entries table. If you only want those of a specific category, you'd do:

Code: Select all

SELECT e.* FROM serendipity_entries AS e, JOIN serendipity_entrycat AS ec ON (ec.entryid = e.id AND ec.categoryid = X)
and replace X with the ID of your "blog" category. Then you can use phpMyAdmin to export the results of that query, and then place them into your new database.

If you have stored entryproperties or tags on those entries, you will do the same with the serendipity_entryproperties and serendipity_freetab DB tables.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
tazilein
Regular
Posts: 56
Joined: Sun Apr 30, 2006 11:44 pm
Contact:

Post by tazilein »

thx garvin. I have different table prefixes as both s9y installations use the same DB -> should I simply change the prefix in the dump in all lines or can this change of the prefix already be done by making the dump

f.ex get all serendipity_entries and save in table myblog_entries in the dump?
my S9Y-Blogs: my personal brainbackup | [url=http://www.viennacityflats,at]Vienna Apartments Rental[/url] | Kasperls Geschichten | various other Sites using S9y as CMS
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

You could do that, but then you'd have ALL entries of the other/old blog.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
tazilein
Regular
Posts: 56
Joined: Sun Apr 30, 2006 11:44 pm
Contact:

Post by tazilein »

My last post was misinterpreted:

I make the dump with the query you wrote in your first entry. If I simply import that dump I will not get the entries where I want, because in my new blog all tables have a different prefix. So after the import my serendipity installation will not find the imported entries. So I think I have to change that prefix so it matches with the prefix of the new one. Everything regarding the old website is not being changed.

Do I create a problem where is none or is it now clear what I mean?
my S9Y-Blogs: my personal brainbackup | [url=http://www.viennacityflats,at]Vienna Apartments Rental[/url] | Kasperls Geschichten | various other Sites using S9y as CMS
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Ah, of course. Yeah, you can do a search+replace on your SQL dump to change serendipity_entries to blog_entries if you want, I think that'S the easiest solution.

Of course, copying the table to a new database and renaming them there would also work....

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
tazilein
Regular
Posts: 56
Joined: Sun Apr 30, 2006 11:44 pm
Contact:

Post by tazilein »

hi garvin,

I now tried to do that mysql-query and got an error message:

Fehler

SQL-Befehl: Dokumentation

SELECT e. *
FROM serendipity_entries AS e,
JOIN serendipity_entrycat AS ec ON ( ec.entryid = e.id
AND ec.categoryid =16 )
LIMIT 0 , 30

MySQL meldet: Dokumentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JOIN serendipity_entrycat AS ec ON ( ec . entryid = e . id AND ec . categoryid =' at line 1


MySQL - 4.1.22

Any idea? :cry:
my S9Y-Blogs: my personal brainbackup | [url=http://www.viennacityflats,at]Vienna Apartments Rental[/url] | Kasperls Geschichten | various other Sites using S9y as CMS
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Try it with:

Code: Select all

SELECT e. *
FROM serendipity_entries AS e
JOIN serendipity_entrycat AS ec ON ( ec.entryid = e.id
AND ec.categoryid =16 )
without the comma.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply