How to replace old View File macros with the new File Preview macro
目的
Confluence 5.7 introduced File Previews as a new way to visualize attachments: Confluence 5.7 Release Notes. In some cases, you might want to replace the old macros in order to use the new features.
ソリューション
- Confluence を停止します。
- Run the following queries in your Confluence database. These steps were tested in PostgreSQL and might need to be adapted to work with a different database server. Each query is for a different type of file:
MS Word
UPDATE bodycontent SET body = replace(body, 'ac:name="viewdoc"', 'ac:name="view-file"') WHERE contentid IN (SELECT contentid FROM content WHERE prevver IS null AND contenttype in ('BLOGPOST', 'PAGE', 'COMMENT')) AND body LIKE '%ac:name="viewdoc"%';
MS Excel
UPDATE bodycontent SET body = replace(body, 'ac:name="viewxls"', 'ac:name="view-file"') WHERE contentid IN (SELECT contentid FROM content WHERE prevver IS null AND contenttype in ('BLOGPOST', 'PAGE', 'COMMENT')) AND body LIKE '%ac:name="viewxls"%';
MS PowerPoint
UPDATE bodycontent SET body = replace(body, 'ac:name="viewppt"', 'ac:name="view-file"') WHERE contentid IN (SELECT contentid FROM content WHERE prevver IS null AND contenttype in ('BLOGPOST', 'PAGE', 'COMMENT')) AND body LIKE '%ac:name="viewppt"%';
PDF
UPDATE bodycontent SET body = replace(body, 'ac:name="viewpdf"', 'ac:name="view-file"') WHERE contentid IN (SELECT contentid FROM content WHERE prevver IS null AND contenttype in ('BLOGPOST', 'PAGE', 'COMMENT')) AND body LIKE '%ac:name="viewpdf"%';
- Confluence を起動します。
データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。
最終更新日: 2016 年 2 月 26 日
Powered by Confluence and Scroll Viewport.