예제 #1
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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public void Process(BlogMLPost postml)
        {
            Log.DebugFormat("Fetching comments for PostID {0}", postml.ID);

            using (var query = new OxiteReader("SELECT * FROM oxite_Comment A, oxite_User B WHERE A.CreatorUserID = B.UserID AND Username <> 'Anonymous' 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.Username,
                        UserEMail    = comment.Email,
                        Content      = new BlogMLContent
                        {
                            ContentType = ContentTypes.Html,
                            Text        = comment.Body
                        }
                    };

                    postml.Comments.Add(commentml);
                }
            }

            Log.DebugFormat("Finished adding comments.");
        }
예제 #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);
                }
            }
        }
예제 #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);
            }
        }