当deleteOldRevisions内存不足时,如何删除旧的MediaWiki修订版 [英] How to delete old MediaWiki revisions when deleteOldRevisions run out of memory

查看:117
本文介绍了当deleteOldRevisions内存不足时,如何删除旧的MediaWiki修订版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以删除修订版本.我什至没有得到要逐步删除的ID列表.

is there a possibilty to delete revisions , when the maintenance skript deleteOldRevisions runs out of memory (tried to allocate more than 2 GB under 32bit). I not even get the list of the ids to delete it step by step.

也许直接使用SQL?

我已尝试/已阅读 https://www.mediawiki.org/wiki/Manual: Reduce_size_of_the_database 以及使用SQL删除没有Shell访问权限的旧MediaWiki修订版?

I tried/read already https://www.mediawiki.org/wiki/Manual:Reduce_size_of_the_database and also Use SQL to delete old MediaWiki revisions without shell access?

推荐答案

嗯,是的...看过

Mmm, yeah... after taking a peek at that script, I'm not surprised it fails. It really should be fixed to iterate over the pages instead of just building a huge list in memory. I suppose the only reason it hasn't been is that, for wikis like Wikipedia, deleting revisions isn't really something one normally ever does.

无论如何,除了修复脚本之外,我还看到了许多可能的解决方法:

Anyway, besides fixing the script, I see a bunch of possible workarounds:

  • deleteOldRevisions.php脚本可以获取页面ID的列表.您可以尝试一次运行Wiki上的每一页.您甚至可以编写一个简单的Shell脚本来循环运行它,从页面ID 1开始,直到您的Wiki当前最大页面ID为止.

  • The deleteOldRevisions.php script can take a list of page IDs. You could just try running for each page on your wiki, one at a time. You could even write a simple shell script to run it in a loop, starting at page ID 1 and counting up to whatever the current maximum page ID on your wiki is.

或者,您可以对包含以下内容的Wiki进行转储只需每个页面的最新版本,然后删除Wiki上的所有页面(即pagerevisiontext表中的所有内容),然后将它们从转储中导入.

Alternatively, you could make a dump of your wiki containing only the lastest revision of each page, then delete all pages on your wiki (i.e. everything in the page, revision and text tables) and import them back from the dump.

原则上,如果您知道您在做什么,则您还可以直接使用SQL删除旧修订.

In principle, if you know what you're doing, you can also delete old revisions directly using SQL.

总是在弄乱数据库之前要做的第一件事是将Wiki设置为完整备份.如果您以前没有做过,那么在进行真正的Wiki不可撤消的操作之前,最好先将备份还原到本地测试Wiki上.

The first things you always want to do before messing with the database are to set your wiki to read-only mode and make a full backup. If you haven't done this before, it's also a good idea to practice restoring the backup onto a local test wiki before doing anything irrevocable to your real wiki.

然后,要删除每个页面的最新修订以外的所有内容,请运行以下SQL命令:

Then, to delete all but the latest revision of each page, run the following SQL command:

DELETE FROM revision WHERE NOT EXISTS
  ( SELECT * FROM page WHERE page_id = rev_page AND page_latest = rev_id )

请注意,上面的命令只会删除旧修订版 metadata ,而不会删除这些修订版的实际文本.摆脱旧文本记录的最简单方法是运行 purgeOldText.php 维护脚本,尽管您也应该也可以使用SQL来完成,例如:

Note that the command above will only delete the old revision metadata, not the actual text of those revisions. The easiest way to get rid of the old text records is to run the purgeOldText.php maintenance script, although you should be able to do it using SQL too, something like:

DELETE FROM text WHERE NOT EXISTS
  ( SELECT * FROM revision WHERE rev_text_id = old_id )

最后,如果一切顺利,我建议运行 rebuildall.php 维护脚本来解决诸如最近的更改之类的问题,否则这些更改将指向已删除的修订.然后确保一切看起来都应该正常,然后再次关闭只读模式.

Finally, if everything went well, I recommend running the rebuildall.php maintenance script to fix things like recent changes that will otherwise point to deleted revisions. Then make sure that everything looks as it should and turn read-only mode off again.

最后,如果您这样做是为了节省空间,请考虑压缩旧的修订版本,而不是直接删除它们.这样可以节省大量空间,同时仍可让Wiki上的所有修订版保持可用.

Finally, if you're doing this to try and save space, consider compressing your old revisions instead of just outright deleting them. This will save a significant amount of space while still keeping all the revisions available on your wiki.

这篇关于当deleteOldRevisions内存不足时,如何删除旧的MediaWiki修订版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆