导入 WordPress 备份 - 只恢复丢失的帖子?

发布于 2024-10-04 19:21:19 字数 247 浏览 6 评论 0原文

一位客户声称,当她删除用户帐户时,她的 WordPress 网站上的一些帖子丢失了。显然,我在数据库中确实找不到这些帖子。 (我首先想到也许它们没有分配给作者)

现在我有几个站点的完整备份作为 SQL 文件。那里有一篇缺失的文章。然而,我们并不确切知道哪些文章丢失了。

我只想恢复丢失的文章。不恢复整个站点。当前文章不应该被删除!

实现这一目标的最佳方法是什么?将其导入到不同的数据库并以某种方式比较 wp_posts? 谢谢你们!

A customer claims some posts on her wordpress site went missing when she deleted user accounts. Apparently, I really cannot find these posts in the database. (I first thought maybe they were not assigned to an author)

Now I have several full backups of the site as SQL files. One missing article is in there. However, we don't know exactly which articles went missing.

I only want to restore the missing articles. Not restore the whole site. Current articles should not be deleted!

What's the best way to achieve this? Import it to a different database and somehow compare wp_posts?
Thanks guys!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

Oo萌小芽oO 2024-10-11 19:21:19

您可以创建一个临时数据库,
并将您的最新备份导入其中。
之后,执行一个

INSERT IGNORE INTO your_live_data.wp_posts 
SELECT * FROM temporary_database.wp_posts WHERE user_id=xxx

技巧是忽略将忽略覆盖任何现有项目,
这意味着只插入缺少的帖子。

注意:您应该替换所有相关表,而不仅仅是 wp_posts

You can create a temporary database,
and import your latest backup into it.
After that, do a

INSERT IGNORE INTO your_live_data.wp_posts 
SELECT * FROM temporary_database.wp_posts WHERE user_id=xxx

The trick is the IGNORE will ignore to overwrite any existing items,
which mean only insert the missing posts.

NOTE : you should replace all related tables not just wp_posts alone

谁的新欢旧爱 2024-10-11 19:21:19

嗯……这可能会变得棘手,因为有评论、标签、类别等……等等,但我会这样做,但没有测试它:

  1. 首先将旧备份加载到可能在本地的临时数据库中以加快速度 事情
  2. 然后做相反的
  3. :删除所有其他用户(但随后删除用户<>她删除的用户)和随附的帖子 :: 理论上,这个数据库现在将只保存已删除用户的文章,希望将其导出为 xml注释等..
  4. 检查实时数据库中导入的 xml 内容
  5. 并分配给用户 N

p.s.可能值得在 https://wordpress.stackexchange.com/ 上发布!

Hmmmm.... This can get tricky because there are comments, tags, categories, etc.. etc.. but I would do it like this but have not tested it:

  1. first load the old backup in a temporary database possibly locally to speed things up
  2. then do the the reverse: delete all other users (but then the users <> the users she deleted) and accompanying posts :: theoretically this database will now only hold the articles of the deleted users
  3. export this as xml hopefully with comments etc..
  4. check the contents of the xml
  5. import in live database and assign to user N

p.s. might be worth posting on https://wordpress.stackexchange.com/ !!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文