public void Process(BlogMLPost postml)
        {
            Log.DebugFormat("Fetching anonymous comments for PostID {0}", postml.ID);

            using (var query = new OxiteReader("SELECT * FROM oxite_CommentAnonymous A, oxite_Comment B WHERE A.CommentID = B.CommentID AND PostID='" + postml.ID + "'"))
            {
                var comments = query.Execute();

                foreach (var comment in comments)
                {
                    var commentml = new BlogMLComment
                    {
                        ID = comment.CommentID.ToString(),
                        DateCreated = comment.CreatedDate,
                        DateModified = comment.ModifiedDate,
                        Approved = comment.State == (int)RecordStates.Normal,
                        UserName = comment.Name,
                        UserUrl = comment.Url,
                        UserEMail = comment.Email,
                        Content = new BlogMLContent
                        {
                            ContentType = ContentTypes.Html,
                            Text = comment.Body
                        }
                    };

                    postml.Comments.Add(commentml);
                }
            }

            Log.DebugFormat("Finished adding anonymous comments.");
        }
Esempio n. 2
0
        public void Process(BlogMLBlog blogml)
        {
            Log.Info("Fetching Tags.");

            using (var query = new OxiteReader("SELECT * FROM oxite_Tag"))
            {
                var tags = query.Execute();

                foreach (var tag in tags)
                {
                    var category = new BlogMLCategory
                    {
                        Approved = true,
                        DateCreated = tag.CreatedDate,
                        DateModified = tag.CreatedDate,
                        Description = tag.TagName,
                        ID = tag.TagID.ToString(),
                        ParentRef = tag.TagID.ToString() == tag.ParentTagID.ToString() ? "0" : tag.ParentTagID.ToString(),
                        Title = tag.TagName
                    };

                    blogml.Categories.Add(category);
                }
            }

            Log.InfoFormat("Finished adding {0} tags.", blogml.Categories.Count);
        }
        public void Process(BlogMLPost postml)
        {
            Log.Debug("Fetching trackbacks.");

            using (var query = new OxiteReader("SELECT * FROM oxite_Trackback WHERE PostID='" + postml.ID + "'"))
            {
                var trackbacks = query.Execute();

                foreach (var track in trackbacks)
                {
                    var trackbackml = new BlogMLTrackback
                    {
                        Approved = false, /* Oxite has no trackback approving */
                        DateCreated = track.CreatedDate,
                        DateModified = track.ModifiedDate,
                        ID = track.TrackbackID.ToString(),
                        Title = track.Title,
                        Url = track.Url
                    };

                    postml.Trackbacks.Add(trackbackml);
                }
            }

            Log.DebugFormat("Finished adding {0} trackbacks.", postml.Trackbacks.Count);
        }
Esempio n. 4
0
        public void Process(BlogMLBlog blogml)
        {
            Log.Info("Fetching Blog information");

            using (var siteQuery = new OxiteReader("SELECT * FROM oxite_Site"))
            using (var areaQuery = new OxiteReader("SELECT * FROM oxite_Area"))
            {
                var blog = siteQuery.Execute().First();
                var area = areaQuery.Execute().First();

                Log.WarnFormat("This version only supports migration from one Blog and one Area.");
                Log.InfoFormat("Migrating '{0}' blog...", blog.SiteDisplayName);

                blogml.RootUrl = string.Format("{0}/{1}", blog.SiteHost, blog.SiteDisplayName);
                blogml.DateCreated = area.CreatedDate;
                blogml.Title = blog.SiteDescription;
                blogml.SubTitle = area.Description;
            }
        }
        public void Process(BlogMLPost postml)
        {
            Log.DebugFormat("Setting up category references on post {0}", postml.ID);

            using (var query = new OxiteReader("SELECT * FROM oxite_Post A, oxite_PostTagRelationship B WHERE A.PostID=B.PostID AND A.PostID='" + postml.ID + "'"))
            {
                var tagRefs = query.Execute();

                foreach(var tag in tagRefs)
                {
                    var commentRef = new BlogMLCategoryReference
                    {
                        Ref = tag.TagID.ToString()
                    };

                    postml.Categories.Add(commentRef);
                }
            }
        }
Esempio n. 6
0
        private void ProcessPosts(BlogMLBlog blogml)
        {
            Log.Info("Fetching blog posts.");

            using (var query = new OxiteReader("SELECT * FROM oxite_Post"))
            {
                var posts = query.Execute();

                foreach (var post in posts)
                {
                    var postml = new BlogMLPost
                    {
                        Content = new BlogMLContent
                        {
                            ContentType = ContentTypes.Html,
                            Text = post.Body
                        },
                        Excerpt = new BlogMLContent
                        {
                            ContentType = ContentTypes.Html,
                            Text = post.BodyShort
                        },
                        Approved = post.State == (int)RecordStates.Normal,
                        DateCreated = post.CreatedDate,
                        DateModified = post.ModifiedDate,
                        HasExcerpt = !string.IsNullOrWhiteSpace(post.BodyShort),
                        ID = post.PostID.ToString(),
                        PostName = post.Title,
                        PostType = BlogPostTypes.Normal,
                        PostUrl = post.Slug,
                        Title = post.Title,
                    };

                    blogml.Posts.Add(postml);
                }

                Log.InfoFormat("Finished adding {0} posts.", blogml.Posts.Count);
            }
        }