Gexrior 2018-08-19
属性垃圾的定义为,一个垃圾用户在 Confluence 创建了用户,但是这个用户在自己的属性页面中添加了垃圾 URL。
如果你有很多垃圾用户在你的系统中创建了属性,你可以使用下面的 SQL 很容易的一次性删除。
如何删除属性中的垃圾:
SELECT bodycontentid,body FROM bodycontent WHERE contentid IN ( SELECT contentid FROM content WHERE contenttype= 'USERINFO' ) ORDER BY bodycontentid DESC ; |
CREATE TEMP TABLE killset AS SELECT <a target="_blank" href="https://www.ancii.com/link/v1/aWNkkFZ_ySKXq8H4-S6bJz9fTk0H0KrGGyVAICrkD62PQgHdwxDJysdPY69ioZjWC0ZV37ol0Tzg5j9CSLha9ThypGDNSq52n0F7NSzIuJU/" rel="nofollow" title="bc.bodycontentid,c.contentid,c.username">bc.bodycontentid,c.contentid,c.username</a> FROM bodycontent bc JOIN content c ON <a target="_blank" href="https://www.ancii.com/link/v1/aWNkkFZ_ySKXq8H4-S6bJz9fTk0H0KrGGyVAICrkD63_oXpnNSqjUym_fEgABxjMUE8NKPwVT0_94BytiXvcmg/" rel="nofollow" title="bc.contentid=c.contentid">bc.contentid=c.contentid</a> WHERE bodycontentid >= BOTTOM_OF_SPAM_RANGE AND bodycontentID <= TOP_OF_SPAM_RANGE AND <a target="_blank" href="https://www.ancii.com/link/v1/aWNkkFZ_ySKXq8H4-S6bJz9fTk0H0KrGGyVAICrkD62jIgRbSzdSOIfAsm3qISgGtUrfQVoSIXrvXo-IZEUTtA/" rel="nofollow" title="c.contenttype=">c.contenttype=</a> 'USERINFO' ; DELETE FROM bodycontent WHERE bodycontentid IN ( SELECT bodycontentid FROM killset); DELETE FROM links WHERE contentid IN ( SELECT contentid FROM killset); DELETE FROM content WHERE prevver IN ( SELECT contentid FROM killset); DELETE FROM content WHERE pageid IN ( SELECT contentid FROM killset); DELETE FROM content WHERE contentid IN ( SELECT contentid FROM killset); DELETE FROM os_user_group WHERE user_id IN ( SELECT id FROM killset k JOIN os_user o ON <a target="_blank" href="https://www.ancii.com/link/v1/aWNkkFZ_ySKXq8H4-S6bJz9fTk0H0KrGGyVAICrkD63jRsD7Y5kJkPKUUtWMTAikTGgI5J_XDB2XDp0lyeJDfQ/" rel="nofollow" title="o.username=k.username);">o.username=k.username);</a> DELETE FROM os_user WHERE username IN ( SELECT username FROM killset); |
如果你使用的是 Confluence 5.6 或者早期的版本,请使用下面的 SQL 命令:
https://www.cwiki.us/display/CONF6ZH/Preventing+and+Cleaning+Up+Spam