バックアップから添付ファイルを取得する

File attachments on pages can be retrieved from a backup without needing to restore the backup into Confluence. This is useful for recovering attachments that have been deleted by users.

Both scheduled and manual backups allow this, as long as the 'Include attachments' property was set.

Before following the instructions for recovering attachments below, we will review how backups store file and page information.

On this page:

関連ページ


ストア ファイルとページ情報のバックアップ方法

バックアップ zip ファイルには、entities.xml、Confluence コンテンツを含む XML ファイル、および添付ファイルを保存しているディレクトリが含まれています。

バックアップ zip ファイルの構造

ページの添付ファイルは、attachments ディレクトリにページと添付ファイル id ごとに保存されています。以下は一覧表示した例です。

Confluence 8.0 以前

Listing for test-2006033012_00_00.zip
\attachments\98\10001                  
\attachments\98\10002                   
\attachments\99\10001                    
entities.xml                             

Confluence 8.1 以降

Listing for test-2006033012_00_00.zip
\attachments\98\10001\1                  
\attachments\98\10002\1                   
\attachments\99\10001\3                    
entities.xml                     

Inside the attachment directory, each numbered directory inside is one page, and the numbered file inside is one attachment. The directory number is the page id, and the file number is the attachment id. For example, the file \attachments\98\10001 is an attachment with page id 98 and attachment id 10001. You can read entities.xml to link those numbers to the original filename. Entities.xml also links each page id to the page title.

entities.xml の Attachment オブジェクト

entities.xml 内では、Attachment オブジェクトが XML で記述されています。この例では、ページ id が98、添付ファイル id が10001で、ファイル名が myimportantfile.doc となっています。XML の他の部分は無視することができます。

<object class="Attachment" package="com.atlassian.confluence.pages">
    <id name="id">10001</id>
    <property name="title">myimportantfile.doc</property>
    <property name="lowerTitle">myimportantfile.doc</property>
    <property name="version">1</property>
    ...
    <property name="containerContent" class="Page" package="com.atlassian.confluence.pages"><id name="id">98</id></property>
    ...
</object> 

entities.xml の Page オブジェクト

この XML はページを示しています。この例では、ページ id が98で、タイトルが Editing Your Files となっています。XML の他の部分は無視することができます。

<object class="Page" package="com.atlassian.confluence.pages">
    <id name="id">98</id>
    <property name="title"><![CDATA[Editing Your Files]]></property>
    ...
</object> 

添付ファイルの復旧の手順

以下の手順に従って、各ファイルを個別に名前の変更および Confluence に再アップロードする必要があります。3つの方法のうち1つを選択してください。

To recover the latest version of each attachment each file must be individually renamed and re-uploaded back into Confluence by following the instructions below. Choose one of the three methods:

選択肢 A - ファイル名ごとに添付ファイルを復旧

This option is best if you know each filename you need to restore, especially if you want just a few files.

  1. Unzip the backup directory and open entities.xml

  2. Search entities.xml for the filename and find the attachment object with that filename. Locate its page and attachment id

  3. Using the page and attachment id from entities.xml, go to the attachments directory and open that directory with that page id. Locate the directory with the attachment id

  4. Inside the attachment directory rename the file with the highest number to the original filename and test it

  5. Repeat for each attachment directory

  6. To import each file back into Confluence, upload to the original page by attaching the file from within Confluence

選択肢 B - ページごとにファイルを復元

This option is best if you only want to restore attachments for certain pages.

  1. Unzip the backup directory and open entities.xml

  2. Search entities.xml for the page title and find the page object with that title. Locate its page id

  3. Go to the attachments directory and open that directory with that page id. Rename this directory to the page title

  4. Search entities.xml for attachment objects with that page id. Every attachment object for the page will have an attachment id, version and filename

  5. For each attachment object find the attachment directory and rename the file with the highest number (latest version) to the original filename and test it

  6. Repeat for each page

  7. To import each file back into Confluence, upload to the original page by attaching the file from within Confluence

選択肢 C - すべてのファイルを復元

This option is best if you have a small backup but want to restore many or all the attachments inside.

The following process is applicable to space backups only. Site XML backups do not require page id to be updated manually due to the nature of persistent page_ids.

  1. Unzip the backup directory and open entities.xml
  2. Go to the attachments directory and open any directory. The directory name is a page id. Each of the files in the directory is an attachment that must be renamed
  3. Search entities.xml for attachment objects with that page id. When one is found, locate the attachment id and filename
  4. Rename the file with that attachment id to the original filename and test it
  5. Find the next attachment id and rename it. Repeat for each file in the directory
  6. Once all files in the current directory are renamed to their original filenames, search entities.xml for the page id, eg directory name. Find the page object with that page id and locate its page title
  7. Rename the directory to the page title and move on to the next directory. Repeat for each un-renamed directory in the attachments directory
  8. To import each file back into Confluence, upload to the original page by attaching the file from within Confluence
最終更新日 2023 年 5 月 22 日

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

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