Moving posts from one blog to another

rated by 0 users
This post has 5 Replies | 1 Follower

Not Ranked
Posts 34
Points 500
PifGadget Posted: Wed, Feb 14 2007 1:23 AM

Hi,

Mi website is under CS 2.1 SP2 and I'm currently changing my CS site organization: I was using one common blog and I decided to create different blogs to organize my blog posts.
I would like to move some posts previously posted in my common blog to other blogs.

How can I move posts from one blog to another within the same CS site?

Thanks in advance for your answers

Top 25 Contributor
Posts 2,115
Points 27,605
MVPs

There are two choices for you:

1- You can use my BlogML to export posts from first blog to this format then import them to second one.

2- You can change some fields in database to move posts from one section (blog) to another.  I don't recommend this second one though because one mistake can provide more troubles.

BlogML is a good choice, I think.  Export all posts to this format then remove unnecessary posts and finally import them to second blog.

  • | Post Points: 20
Not Ranked
Posts 34
Points 500
PifGadget replied on Wed, Feb 14 2007 10:28 AM

Hi Keyvan,

Thanks a lot for your answer.
Even though BlogML seems very nice, I think I still am gonna use choice 2 for one reason: I want the post to retain all their initial characteristics (Author Name, Date Posted, Number of Views, Tags, etc.) which BlogML doesn't seems to deal with.

Do you know which DB fields I should modify to move posts? Would changing SectionID value into the target blog SectionID in the cs_Posts table be sufficient? That way, all other data would be kept for the posts moved.

Thanks a lot for your help

Edit: After a first look at the DB structure, it seems that I would have to change values in at least 5 tables: cs_Posts, cs_Post_Categories, cs_Threads, cs_Referrals, cs_SearchBarrel. I'm gonna try to examine the DB structure more deeply to be sure I don't miss anything. Any help is welcome if somebody already did this before. It would be a good idea to develop a tool which could allow such moving operations since it's "just" database field changes.

Top 200 Contributor
Posts 108
Points 1,255

I have the need to move posts from one blog to another in the same CS site and I also want to use the 2nd choice (SQL script). If anyone has a working script, please let me know. Thanks 

http://blog.davestechshop.net
  • | Post Points: 5
Top 200 Contributor
Posts 108
Points 1,255

This is a hasty solution I threw together for mass moving everything (posts, comments, etc.) from one blog to another. I'm not sure it is 100% ideal, but it works. I used it on a production site 5 days ago and I have not seen any evidence of any problems as a result. Everything got moved properly and all the info was retained.

If the old SectionID is 42 and the new one is 55, the query would look like this:

update cs_Post_Categories_Parents set SectionID = 55 where SectionID = 42
GO
update cs_SectionsRead set SectionID = 55 where SectionID = 42
GO
update cs_FavoriteSections set SectionID = 55 where SectionID = 42
GO
update cs_vw_PostsWithAttachmentDetails set SectionID = 55 where SectionID = 42
GO
update cs_ForumPingback set SectionID = 55 where SectionID = 42
GO
update cs_BlogActivityReport set SectionID = 55 where SectionID = 42
GO
update cs_PostAttachments set SectionID = 55 where SectionID = 42
GO
update csm_MailingLists set SectionID = 55 where SectionID = 42
GO
update csm_EmailIds set SectionID = 55 where SectionID = 42
GO
update cs_PostAttachments_TEMP set SectionID = 55 where SectionID = 42
GO
update cs_RollerBlogFeeds set SectionID = 55 where SectionID = 42
GO
update cs_RollerBlogPost set SectionID = 55 where SectionID = 42
GO
update cs_Post_Categories set SectionID = 55 where SectionID = 42
GO
update cs_SectionTokens set SectionID = 55 where SectionID = 42
GO
update cs_InkData set SectionID = 55 where SectionID = 42
GO
update cs_ThreadsRead set SectionID = 55 where SectionID = 42
GO
update cs_posts_deleted_archive set SectionID = 55 where SectionID = 42
GO
update cs_Posts set SectionID = 55 where SectionID = 42
GO
update cs_Referrals set SectionID = 55 where SectionID = 42
GO
update cs_ModerationAudit set SectionID = 55 where SectionID = 42
GO
update cs_LinkCategories set SectionID = 55 where SectionID = 42
GO
update cs_Moderators set SectionID = 55 where SectionID = 42
GO
update cs_SearchBarrel set SectionID = 55 where SectionID = 42
GO
update cs_Threads set SectionID = 55 where SectionID = 42
GO
update cs_nntp_Posts set SectionID = 55 where SectionID = 42
GO
update cs_TrackedSections set SectionID = 55 where SectionID = 42
GO
update cs_nntp_Newsgroups set SectionID = 55 where SectionID = 42
GO
update cs_PostsArchive set SectionID = 55 where SectionID = 42
GO

 

The 3 tables not included above are:

cs_SectionPermissions 

cs_Sections

cs_weblog_Weblogs

http://blog.davestechshop.net
  • | Post Points: 5
Top 200 Contributor
Posts 108
Points 1,255

For moving just some posts or  comments from one blog to another, a different approach is needed. It is a real pain. I would like to see CS implement a UI tool for moving content. Here is what I had to do to move 3 comments from one blog post to another.

  1. Look in database to find PostID's of comments to be moved.
  2. Look in database to find PostID of destination post where comment would be moved to. Note its ThreadID and SectionID.
  3. Note how many existing comments there are on the destination post. The blog post itself has a search order of 1 and each comment under the post has a search order that is incremented by one (so the first comment has a search order of 2).
  4. In cs_Posts set ParentID to the PostID of the destination post and set ThreadID and SectionID to the values of the destination post too.
  5. In cs_Posts set the sort order so that the new comments appear where you want them to appear.
  6. In cs_Threads set the TotalReplies value to the new comment count for the record with the TreadID obtained in step 2.

In the example above the comment title wasn't changed so it still says, "RE: old topic" although it has been moved to "new topic." I didn't need to change that, but you might. If you need to change this, set a new text value for "Subject" in cs_Posts.

I assume this method surely misses some things that need to be updated. I'd appreciate hearing from others who have more info.

 

http://blog.davestechshop.net
  • Filed under:
  • | Post Points: 5
Page 1 of 1 (6 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com