IT技术博客大学习 共学习 共进步
全部 移动开发 后端 数据库 AI 算法 安全 DevOps 前端 设计 开发者

drupal转worldpress

MySQL支持 2009-11-30 09:04:35 累计浏览 1,885 次
本机暂存

    用Drupal太灵活了,灵活的我都搞不定了。所以我投向了worldpress.对比了一下表结构。参考网上的说明搞出了:

    use support;

    delete from wp_posts;

    delete from wp_comments;

    # posts

    INSERT INTO

     wp_posts (id, post_date, post_content, post_title,

     post_excerpt, post_name, post_modified)

    SELECT DISTINCT

     n.nid, FROM_UNIXTIME(created), body, n.title,

     teaser,

     REPLACE(REPLACE(REPLACE(REPLACE(LOWER(n.title),’ ‘, ‘_’),’.\', ‘_’),’,\', ‘_’),’+\', ‘_’),

     FROM_UNIXTIME(changed)

    FROM drupal_bak.node n, drupal_bak.node_revisions r

    WHERE n.vid = r.vid;

    # comments

    INSERT INTO

     wp_comments

     (comment_post_ID, comment_date, comment_content, comment_parent, comment_author, comment_author_email, comment_author_url)

    SELECT

     nid, FROM_UNIXTIME(timestamp),

     comment, thread, name, mail, homepage

    FROM drupal_bak.comments ;

    # update comments count on wp_posts table

    UPDATE `wp_posts` SET `comment_count` = (SELECT COUNT(`comment_post_id`) FROM `wp_comments` WHERE `wp_posts`.`id` = `wp_comments`.`comment_post_id`);

    # fix post slugs. first we have to remove the duplicate _____ chars, then replace that with a single - char

    UPDATE wp_posts set post_name = REPLACE(post_name, ‘__’, ‘_’);

    UPDATE wp_posts set post_name = REPLACE(post_name, ‘__’, ‘_’);

    UPDATE wp_posts set post_name = REPLACE(post_name, ‘__’, ‘_’);

    UPDATE wp_posts set post_name = REPLACE(post_name, ‘__’, ‘_’);

    UPDATE wp_posts set post_name = REPLACE(post_name, ‘_’, ‘-’);

    然后就可以看到worldpress工作了。

同分类推荐文章

  1. 等了十年的 Go 链式管道,终于来了:seq 让你像写 Scala 一样写 Go (2026-06-25 18:38:18)
  2. Go 实验特性详解 (2026-06-21 10:05:27)
  3. amd64 微架构级别对 Go 程序性能提升多少? (2026-06-21 09:38:49)

查看更多 后端 文章 →

建议继续学习

  1. 使用gettext来支持PHP的多语言 (累计阅读 39,270)
  2. WordPress插件开发 -- 在插件使用数据库存储数据 (累计阅读 29,164)
  3. Paypal接口详细代码(PHP版,非API接口) (累计阅读 19,408)
  4. 我的PHP,Python和Ruby之路 (累计阅读 13,148)
  5. include(“./file.php”)和include(“file.php”)区别 (累计阅读 12,789)
  6. 15个最好的免费开源电子商务平台 (累计阅读 12,541)
  7. Redis消息队列的若干实现方式 (累计阅读 12,088)
  8. 到底什么是MVC? (累计阅读 11,868)
  9. 整理了一份招PHP高级工程师的面试题 (累计阅读 11,709)
  10. Rolling cURL: PHP并发最佳实践 (累计阅读 11,488)