<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>睡到25点 &#187; lbs</title>
	<atom:link href="http://www.voidman.com/tag/lbs/feed" rel="self" type="application/rss+xml" />
	<link>http://www.voidman.com</link>
	<description>个人博客，记录与分享。</description>
	<lastBuildDate>Thu, 12 Jan 2012 14:00:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>LBS 转 WordPress 不完全记录</title>
		<link>http://www.voidman.com/2009/03/lbs-to-wordpress.html</link>
		<comments>http://www.voidman.com/2009/03/lbs-to-wordpress.html#comments</comments>
		<pubDate>Sun, 22 Mar 2009 04:04:27 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Blog Related]]></category>
		<category><![CDATA[iis rewrite]]></category>
		<category><![CDATA[lbs]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.voidman.com/?p=250</guid>
		<description><![CDATA[<p class="page-links"><strong>Pages:</strong> 1 <a href="http://www.voidman.com/2009/03/lbs-to-wordpress-2.html">2</a></p>早就答应 Cure 要帮他把博客从 LBS 转到 WordPress，事实上从他的闪光花园开始长了杂草之后，我就一直鼓动他转到 WordPress 下。或许是一直借口太忙了又或是自我标榜的“完美主义”在作怪，总之断断续续拖拖拉拉，从一月份一直到前些日子才将闪光花园的 LBS 主题改写成 WordPress 版本的，基本上了保留了原貌，用 Cure 的话说和之前没什么两样。尝试用了下 CSS Sprite，把一大堆不同类的背景图片弄到一起看起来是个失误，不过暂时也懒得改了。 ACCESS TO MySQL 数据转换费了一些周折。找了个工具叫 Bullzip MS Access to MySQL，在 XP 下却不能正常使用，提示“Error in function 'cmdNext_Click'”之类的错误。官方论坛有人说是 ADO 不存在的缘故，不过折腾了半天问题照旧。后来在安装了 SQL SERVER 的WIN2003系统下成功将数据 Dump 成 SQL 文本，可中文却是乱码，崩溃。最后还是用了月光的转换软件搞定，不过月光的软件不会生成创建表结构的语句，所以还是两者结合了一下，才将 LBS &#8230; <a href="http://www.voidman.com/2009/03/lbs-to-wordpress.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p class="page-links"><strong>Pages:</strong> 1 <a href="http://www.voidman.com/2009/03/lbs-to-wordpress-2.html">2</a></p><p>早就答应 Cure 要帮他把博客从 LBS 转到 WordPress，事实上从他的<a href="http://www-s-isle.com/blog/">闪光花园</a>开始长了杂草之后，我就一直鼓动他转到 WordPress 下。或许是一直借口太忙了又或是自我标榜的“完美主义”在作怪，总之断断续续拖拖拉拉，从一月份一直到前些日子才将闪光花园的 LBS 主题改写成 WordPress 版本的，基本上了保留了原貌，用 Cure 的话说和之前没什么两样。尝试用了下 CSS Sprite，把一大堆不同类的背景图片弄到一起看起来是个失误，不过暂时也懒得改了。</p>
<p><strong>ACCESS TO MySQL</strong><br />
数据转换费了一些周折。找了个工具叫 Bullzip MS Access to MySQL，在 XP 下却不能正常使用，提示“Error in function 'cmdNext_Click'”之类的错误。官方论坛<a href="http://www.bullzip.com/phpBB/viewtopic.php?t=6338">有人说</a>是 ADO 不存在的缘故，不过折腾了半天问题照旧。后来在安装了 SQL SERVER 的WIN2003系统下成功将数据 Dump 成 SQL 文本，可中文却是乱码，崩溃。最后还是用了<a href="http://www.williamlong.info">月光</a>的<a href="http://www.williamlong.info/archives/1057.html">转换软件</a>搞定，不过月光的软件不会生成创建表结构的语句，所以还是两者结合了一下，才将 LBS 数据转到 MySQL 下。<br />
<span id="more-250"></span><br />
<strong>LBS 数据导入到 WordPress 表中</strong><br />
根据需要，只转换了 blog_article、blog_category、blog_comment 三个表的数据，然后将数据导入 WordPress 表中：</p>

<div class="wp_syntax"><pre class="mysql"><span style="color: #008200; font-style: italic;"># 导入日志</span>
<span style="color: #0000FF; ">INSERT</span> <span style="color: #0000FF; ">INTO</span>  wp_posts <span style="color: #000;">&#40;</span>ID, post_author, post_date, post_content, post_title, post_status, post_modified<span style="color: #000;">&#41;</span>
<span style="color: #0000FF; ">SELECT</span> log_id, <span style="color: #840000;">2</span>, log_postTime, <span style="color: #0000FF; ">CONCAT</span><span style="color: #000;">&#40;</span>log_content0, <span style="color: #0000FF; ">CHAR</span><span style="color: #000;">&#40;</span><span style="color: #840000;">13</span><span style="color: #000;">&#41;</span>, <span style="color: #FF00FF;">'&lt;!--more--&gt;'</span>, <span style="color: #0000FF; ">CHAR</span><span style="color: #000;">&#40;</span><span style="color: #840000;">13</span><span style="color: #000;">&#41;</span>, log_content1<span style="color: #000;">&#41;</span>, log_title, <span style="color: #FF00FF;">'publish'</span>, log_postTime
<span style="color: #0000FF; ">FROM</span> blog_article
&nbsp;
<span style="color: #008200; font-style: italic;"># 导入评论</span>
<span style="color: #0000FF; ">INSERT</span> <span style="color: #0000FF; ">INTO</span> wp_comments <span style="color: #000;">&#40;</span>comment_ID, comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id <span style="color: #000;">&#41;</span>
<span style="color: #0000FF; ">SELECT</span> comm_id, log_id, comm_author, <span style="color: #FF00FF;">''</span>, <span style="color: #FF00FF;">''</span>, comm_ip, comm_postTime, comm_content, <span style="color: #840000;">1</span>, <span style="color: #FF00FF;">''</span>, <span style="color: #FF00FF;">''</span>, <span style="color: #840000;">0</span>, <span style="color: #840000;">0</span>
<span style="color: #0000FF; ">FROM</span> blog_comment
&nbsp;
<span style="color: #008200; font-style: italic;"># 更新日志的评论数</span>
<span style="color: #0000FF; ">UPDATE</span> wp_posts p, <span style="color: #000;">&#40;</span>SELECTcomment_post_ID AS pid, COUNT<span style="color: #000;">&#40;</span>*<span style="color: #000;">&#41;</span> AS counts <span style="color: #0000FF; ">FROM</span> wp_comments <span style="color: #0000FF; ">GROUP</span> <span style="color: #0000FF; ">BY</span> comment_post_ID<span style="color: #000;">&#41;</span> c
<span style="color: #0000FF; ">SET</span> p.comment_count = c.counts
<span style="color: #0000FF; ">WHERE</span> p.ID = c.pid
&nbsp;
<span style="color: #008200; font-style: italic;"># 导入日志类别</span>
<span style="color: #008200; font-style: italic;"># 类别不多，直接在后台里手工添加了</span>
&nbsp;
<span style="color: #008200; font-style: italic;"># 更新新旧类别对应关系</span>
<span style="color: #008200; font-style: italic;"># 在 blog_category 增加 cat_newid 字段，将类别的新ID填入此字段，同样手工操作了</span>
&nbsp;
<span style="color: #008200; font-style: italic;"># 导入日志与分类关系</span>
<span style="color: #0000FF; ">INSERT</span> <span style="color: #0000FF; ">INTO</span> wp_term_relationships <span style="color: #000;">&#40;</span>object_id, term_taxonomy_id<span style="color: #000;">&#41;</span>
<span style="color: #0000FF; ">SELECT</span> log_id, c.cat_newid
<span style="color: #0000FF; ">FROM</span> blog_article a, blog_category c
<span style="color: #0000FF; ">WHERE</span> a.log_catID = c.cat_id
&nbsp;
<span style="color: #008200; font-style: italic;"># 更新分类下日志数</span>
<span style="color: #0000FF; ">UPDATE</span> wp_term_taxonomy t, <span style="color: #000;">&#40;</span><span style="color: #0000FF; ">SELECT</span> term_taxonomy_id, count<span style="color: #000;">&#40;</span>*<span style="color: #000;">&#41;</span> AS counts <span style="color: #0000FF; ">FROM</span> wp_term_relationships <span style="color: #0000FF; ">GROUP</span> <span style="color: #0000FF; ">BY</span> term_taxonomy_id<span style="color: #000;">&#41;</span> r
<span style="color: #0000FF; ">SET</span> t.count = r.counts
<span style="color: #0000FF; ">WHERE</span> t.term_taxonomy_id = r.term_taxonomy_id</pre></div>

<p><strong>日志和评论内容UBB代码转换</strong><br />
Cure 的日志基本上只用了 URL, FONT, SIZE, CENTER, IMG 这几个 UBB 代码，所以干脆将数据导出到SQL文本中，直接用 Editplus 的正则替换功能将UBB 代码转成了 HTML 。</p>
<h4>Related Posts</h4><ul class="related_post"><li><a href="http://www.voidman.com/2009/05/using-wordpress-plugin-api-hack-discuz.html" title="WordPress 的 Hook 机制在 Discuz 二次开发中的应用">WordPress 的 Hook 机制在 Discuz 二次开发中的应用</a></li><li><a href="http://www.voidman.com/2009/04/at-reply-mail-notification-1-release.html" title="At Reply Mail Notification 1.0 Release">At Reply Mail Notification 1.0 Release</a></li><li><a href="http://www.voidman.com/2009/01/wordpress-is-using-a-bad-way-to-detect-duplicate-comment.html" title="Wordpress 糟糕的重复评论检测方式">Wordpress 糟糕的重复评论检测方式</a></li><li><a href="http://www.voidman.com/2009/01/at-reply-mail-notification-test.html" title="At Reply Mail Notification 测试贴">At Reply Mail Notification 测试贴</a></li><li><a href="http://www.voidman.com/2008/11/automatically-delete-post-revisions.html" title="让 Wordpress 自动删除 Post Revisions">让 Wordpress 自动删除 Post Revisions</a></li><li><a href="http://www.voidman.com/2008/11/google-xml-sitemaps-ignore-the-specified-categories.html" title="让 Google Sitemaps Generator 可以忽略指定的日志分类">让 Google Sitemaps Generator 可以忽略指定的日志分类</a></li><li><a href="http://www.voidman.com/2008/11/the-better-solution-for-static-paged-post.html" title="Wordpress 分页文章静态化的更优解决方案">Wordpress 分页文章静态化的更优解决方案</a></li><li><a href="http://www.voidman.com/2008/07/upgraded-to-wordpress-v26.html" title="升级到 WordPress 2.6">升级到 WordPress 2.6</a></li><li><a href="http://www.voidman.com/2008/03/upgraded-to-wordpress-25-rc1.html" title="升级到 WordPress 2.5 RC1">升级到 WordPress 2.5 RC1</a></li><li><a href="http://www.voidman.com/2008/03/wordpress-theme-wpcandy-remix.html" title="WordPress Theme WPCandy Remix">WordPress Theme WPCandy Remix</a></li></ul><hr /><a href="http://www.voidman.com">Voidman.com</a> | Link: <a href="http://www.voidman.com/2009/03/lbs-to-wordpress.html">http://www.voidman.com/2009/03/lbs-to-wordpress.html</a><br /><img alt="linezing" width="1" height="1" src="http://img.tongji.linezing.com/288120/tongji.gif" />]]></content:encoded>
			<wfw:commentRss>http://www.voidman.com/2009/03/lbs-to-wordpress.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

