How to Locate All Orphaned Pages in Confluence

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

目的

An orphaned page is a page without any incoming links. This means that, unless you know that the page exists, you are not likely to come across it in the space during the natural course of navigation.

Confluence 6.15 and earlier has a built-in method to identify orphaned pages on a space-by-space basis (see: Orphaned Pages). Given an instance of Confluence with a large number of spaces, however, a site administrator may want a way to locate every orphaned page across all spaces at once as part of a housekeeping effort or cleanup. The SQL query provided below can be run against the Confluence database to return this information.

ソリューション

  • The following query was tested against Confluence 5.x, using Postgres, MySQL, Oracle   and MSSQL database servers.
SELECT s.SPACENAME, s.SPACEKEY, s.SPACEID, c.TITLE, c.CONTENTID
FROM   CONTENT c,
       SPACES s
WHERE  c.CONTENTTYPE = 'PAGE'
       AND ( ( c.PREVVER IS NULL )
             AND ( c.CONTENT_STATUS = 'current' )
             AND ( Lower(s.SPACEKEY) IN (SELECT Lower(SPACEKEY) FROM SPACES)
                   AND c.SPACEID = s.SPACEID )
             AND ( ( s.HOMEPAGE != c.CONTENTID
                     AND c.SPACEID = s.SPACEID )
                    OR ( s.HOMEPAGE IS NULL
                         AND c.SPACEID = s.SPACEID ) )
             AND ( c.PARENTID IS NULL )
             AND ( NOT EXISTS(SELECT l.LINKID
                              FROM   LINKS l,
                                     SPACES s2,
                                     CONTENT c2
                              WHERE  (
                             l.DESTSPACEKEY = s2.SPACEKEY
                             AND
                             c.SPACEID = s2.SPACEID )
                                     AND
                             ( Lower(l.DESTPAGETITLE) =
                               Lower(c.TITLE) )
                                     AND ( Lower(c2.TITLE) !=
                                           Lower(c.TITLE)
                                           AND l.CONTENTID =
                                               c2.CONTENTID )) ) );
 

データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。

Last modified on Mar 22, 2019

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.