截断 mediawiki

发布于 2024-08-08 17:11:19 字数 296 浏览 1 评论 0原文

我正在使用 mediawiki API(例如 http://en.wikipedia.org/w/ api.php),我希望能够“截断”mysql 表,以便重置本地安装,同时保留一些表(用户,?...)。 SQL 查询是什么?

我想说:调整除 ${PREFIX}_user 之外的所有表并更新 ${PREFIX}_user set user_editcount=0 ?

还有其他(更安全的)建议吗?

I'm working with the mediawiki API ( e.g. http://en.wikipedia.org/w/api.php) and I would like to be able to 'truncate' the mysql tables in order to reset the local installation while keeping some tables (users, ?...).
What would be the SQL queries ?

I would say: tuncate all the tables but ${PREFIX}_user and update ${PREFIX}_user set user_editcount=0 ?

Any other(safer) suggestion ?

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

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

发布评论

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

评论(2

正确答案已发布在 MediaWiki 邮件列表上:请参阅 http: //lists.wikimedia.org/pipermail/mediawiki-l/2009-October/032322.html

根据该帖子,截断 user_newtalk, page< 可能是可以的/code>、修订版文本
存档页面链接模板链接图像链接类别链接类别< /code>、外部链接langlinks点击计数器监视列表图像、<代码>oldimagefilearchive最近更改searchindexinterwikiquerycache、<代码>objectcache、<代码>log_search、<代码>引用、<代码>作业、<代码>querycache_info、<代码>redirectquerycachetwopage_restrictionsprotected_titlespage_propschange_tags >、tag_summaryvalid_tagl10n_cache

在较新的版本中,将 msg_resourcemsg_resource_list 添加到该列表中,即 截断消息相关缓存

另外:如果截断图像,请记住删除图像文件夹中的文件
图像表。否则它们将不同步,并且您可能无法上传某些图像。

The correct answer was posted on the MediaWiki mailing list: see http://lists.wikimedia.org/pipermail/mediawiki-l/2009-October/032322.html

According to that post, it is probably ok to truncate user_newtalk, page, revision, text,
archive, pagelinks, templatelinks, imagelinks, categorylinks, category, externallinks, langlinks, hitcounter, watchlist, image, oldimage, filearchive, recentchanges, searchindex, interwiki, querycache, objectcache, log_search, trackbacks, job, querycache_info, redirect, querycachetwo, page_restrictions, protected_titles, page_props, change_tags, tag_summary, valid_tag, l10n_cache.

On more recent versions, add msg_resource and msg_resource_list to that list, to truncate message related caches.

Also: Remember to delete the files at the image folder, if truncating the
image table. Otherwise they will be out of sync, and you might have trouble uploading some images.

我不会写诗 2024-08-15 17:11:19

从数据库中获取表列表:

echo "show tables;" | mysql -u user_name -p db_name > tables

确定要截断哪些表,然后创建一个 sql 脚本,

TRUNCATE TABLE a;
TRUNCATE TABLE b;
update <prefix>user set user_editcount=0;

然后通过客户端运行它:

mysql -u user_name -p database_name < truncate-all.sql

get list of tables from your database:

echo "show tables;" | mysql -u user_name -p db_name > tables

determine which tables you want to truncate, then create an sql script

TRUNCATE TABLE a;
TRUNCATE TABLE b;
update <prefix>user set user_editcount=0;

then run it through the client:

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