一次删除所有跟踪页面

发布于 2024-09-28 14:50:47 字数 49 浏览 2 评论 0原文

有没有办法清理、删除所有维基页面,这样我就可以有一个干净的索引,只包含我创建的页面?

is there a way to clean, delete all the wiki pages so i can have a clean index, with only the pages i have created ?

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

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

发布评论

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

评论(4

无言温柔 2024-10-05 14:50:47

你可以像这样破解 trac-admin:

#!/bin/sh

# extract the page list from trac (this filter matches only CamelCase words or numbers,
# it will blow if there are pages which does not fit into this scheme)
for site in `trac-admin /path/to/trac wiki list | sed -e 's/\([a-zA-Z0-9]*\).*/\1/'`
do
    # and remove every single page
    trac-admin /path/to/trac wiki remove $site
done

You can hack around trac-admin like this:

#!/bin/sh

# extract the page list from trac (this filter matches only CamelCase words or numbers,
# it will blow if there are pages which does not fit into this scheme)
for site in `trac-admin /path/to/trac wiki list | sed -e 's/\([a-zA-Z0-9]*\).*/\1/'`
do
    # and remove every single page
    trac-admin /path/to/trac wiki remove $site
done
夜血缘 2024-10-05 14:50:47

注意事项:之前进行经过验证的备份,最终清除用户对标准页面的更改*)。

如果您可以获得直接数据库访问权限,您应该输入以下简单的 SQL 语句:

SELECT name FROM wiki WHEREauthor='trac';

所有 wiki 页面的名称

  1. 它返回由 Trac 本身创建的 (在 Trac 环境中自动创建)创建别名“init”)
  2. 稍后通过 trac-admin CLI 导入、加载或升级(trac-adminwiki

您可以更改,即通过在适当的 SQL 中使用更多条件扩展语句来排除某些页面句法。

当 SELECT 返回准确您要查找的页面时,您所要做的就是将同一语句更改为 DELETE:

DELETE FROM wiki WHEREauthor='trac';

除了您的自定义 wiki 页面之外的所有页面都将在这一秒消失。

*) 仍然可以随时恢复原始内容,只需在具有适当权限的终端会话中执行以下命令即可:

trac-admin <env> wiki upgrade

Precaution: Make a verified-good backup before, the cleanup of user changes to standard pages is final *).

Provided you can gain direct db access you should type the following simple SQL statement:

SELECT name FROM wiki WHERE author='trac';

It returns names of all wiki pages

  1. created by Trac itself (automatically on Trac environment creation alias 'init')
  2. imported, loaded or upgraded via trac-admin CLI later on (trac-admin <env> wiki <action>)

You may change, i.e. exclude some pages by extending the statement with further conditions in appropriate SQL syntax.

When a SELECT returns exactly the pages you're after, all you have to do is changing the same statement into a DELETE:

DELETE FROM wiki WHERE author='trac';

All but your custom wiki pages will be gone this second.

*) Original content could still be restored at any time by just executing the following command in a terminal session with appropriate permissions:

trac-admin <env> wiki upgrade
无法回应 2024-10-05 14:50:47

您可以简单地执行:

$ trac-admin /path/to/trac wiki remove *

如果您想更有选择性地使用图形工具,您可以使用适用于 Linux 和 Windows 的 sqlitebrowser。

You may simply execute:

$ trac-admin /path/to/trac wiki remove *

If you want to be more selective using a graphical tool, you can use sqlitebrowser available for both linux and windows.

谁许谁一生繁华 2024-10-05 14:50:47

如果您使用 sqlite 作为数据库(trac 的标准)。使用此命令删除带有作者 trac 的 wiki 条目:

sqlite3  /your/path/to/trac.db "DELETE FROM wiki WHERE author='trac'"

If you use sqlite as database (standard for trac). Use this command to delete wiki entries with author trac:

sqlite3  /your/path/to/trac.db "DELETE FROM wiki WHERE author='trac'"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文