paul@20 | 1 | Introduction
|
paul@20 | 2 | ------------
|
paul@20 | 3 |
|
paul@20 | 4 | ConfluenceConverter is a distribution of software that converts exported data
|
paul@100 | 5 | from Confluence wiki instances, provided in the form of an XML file, to a
|
paul@100 | 6 | collection of wiki pages and resources that can be imported into a MoinMoin
|
paul@20 | 7 | instance as a page package.
|
paul@20 | 8 |
|
paul@20 | 9 | Prerequisites
|
paul@20 | 10 | -------------
|
paul@20 | 11 |
|
paul@20 | 12 | ConfluenceConverter requires a library called xmlread that can be found at the
|
paul@20 | 13 | following location:
|
paul@20 | 14 |
|
paul@20 | 15 | http://hgweb.boddie.org.uk/xmlread
|
paul@20 | 16 |
|
paul@20 | 17 | The xmlread.py file from the xmlread distribution can be copied into the
|
paul@20 | 18 | ConfluenceConverter directory.
|
paul@20 | 19 |
|
paul@40 | 20 | ConfluenceConverter also requires access to the MoinMoin.wikiutil module found
|
paul@40 | 21 | in the MoinMoin distribution.
|
paul@40 | 22 |
|
paul@20 | 23 | The moinsetup program is highly recommended for the installation of page
|
paul@100 | 24 | packages and the management of MoinMoin wiki instances:
|
paul@20 | 25 |
|
paul@20 | 26 | http://moinmo.in/ScriptMarket/moinsetup
|
paul@20 | 27 |
|
paul@20 | 28 | If moinsetup is not being used, the page package installer documentation
|
paul@20 | 29 | should be consulted:
|
paul@20 | 30 |
|
paul@20 | 31 | http://moinmo.in/HelpOnPackageInstaller
|
paul@20 | 32 |
|
paul@106 | 33 | To read Confluence user profiles on live Confluence sites using the
|
paul@106 | 34 | get_profiles.py program, the libxml2dom library is required:
|
paul@106 | 35 |
|
paul@106 | 36 | http://hgweb.boddie.org.uk/libxml2dom
|
paul@106 | 37 |
|
paul@100 | 38 | MoinMoin Prerequisites
|
paul@100 | 39 | ----------------------
|
paul@100 | 40 |
|
paul@100 | 41 | The page package installer does not preserve user information when installing
|
paul@100 | 42 | page revisions. This can be modified by applying a patch to MoinMoin as
|
paul@100 | 43 | follows while at the top level of the MoinMoin source distribution:
|
paul@100 | 44 |
|
paul@100 | 45 | patch -p1 $CCDIR/patches/patch-moin-1.9-MoinMoin-packages.diff
|
paul@100 | 46 |
|
paul@100 | 47 | Here, CCDIR is the path to the top level of this source distribution where
|
paul@100 | 48 | this README.txt file is found.
|
paul@100 | 49 |
|
paul@49 | 50 | Wiki Content Prerequisites
|
paul@49 | 51 | --------------------------
|
paul@49 | 52 |
|
paul@49 | 53 | For the output of the converter, the following MoinMoin extensions are
|
paul@49 | 54 | required:
|
paul@49 | 55 |
|
paul@49 | 56 | http://moinmo.in/ParserMarket/ImprovedTableParser
|
paul@49 | 57 | http://hgweb.boddie.org.uk/MoinSupport
|
paul@79 | 58 | http://moinmo.in/MacroMarket/Color2
|
paul@49 | 59 |
|
paul@20 | 60 | Quick Start
|
paul@20 | 61 | -----------
|
paul@20 | 62 |
|
paul@100 | 63 | Given an XML export archive file for a Confluence wiki instance (in the
|
paul@100 | 64 | example below, the file is called COM-123456-789012.zip), the following
|
paul@100 | 65 | command can be used to prepare a page package for MoinMoin:
|
paul@20 | 66 |
|
paul@100 | 67 | python convert.py COM-123456-789012.zip COM
|
paul@20 | 68 |
|
paul@20 | 69 | In addition to the filename, a workspace name is required. Confluence appears
|
paul@20 | 70 | to require a workspace as a container for collections of pages, but this also
|
paul@100 | 71 | permits us to selectively import parts of a wiki into MoinMoin. If attachments
|
paul@100 | 72 | were included in the export from Confluence, these will be imported into the
|
paul@100 | 73 | page package.
|
paul@20 | 74 |
|
paul@20 | 75 | The result of the above command will be a directory having the same name as
|
paul@20 | 76 | the chosen workspace, together with a zip archive for that directory's
|
paul@20 | 77 | contents. Thus, the above command would produce a directory called COM and an
|
paul@20 | 78 | archive called COM.zip.
|
paul@20 | 79 |
|
paul@20 | 80 | To import the result, use moinsetup as follows:
|
paul@20 | 81 |
|
paul@20 | 82 | python moinsetup.py -m install_page_package COM.zip
|
paul@20 | 83 |
|
paul@20 | 84 | This requires a suitable moinsetup.cfg file in the working directory.
|
paul@20 | 85 |
|
paul@100 | 86 | Mappings from Identifiers to Pages
|
paul@100 | 87 | ----------------------------------
|
paul@100 | 88 |
|
paul@100 | 89 | Confluence uses numbers to label content revisions, and links to Confluence
|
paul@100 | 90 | sites sometimes use these numbers instead of a readable page name. MoinMoin,
|
paul@100 | 91 | meanwhile, only uses page names and has no external numeric identifier scheme.
|
paul@100 | 92 | Consequently, it is necessary to produce a mapping from Confluence identifiers
|
paul@100 | 93 | to MoinMoin page names. In addition to numeric identifiers, Confluence also
|
paul@100 | 94 | provides "tiny URLs" which are an alphanumeric encoding of the numeric
|
paul@100 | 95 | identifiers.
|
paul@100 | 96 |
|
paul@100 | 97 | To generate mappings for the Confluence content, use the mappings script as
|
paul@100 | 98 | follows:
|
paul@100 | 99 |
|
paul@103 | 100 | tools/mappings.sh COM
|
paul@100 | 101 |
|
paul@100 | 102 | Here, COM is a directory name containing converted Confluence content,
|
paul@100 | 103 | corresponding to a space name in the original Confluence wiki. More than one
|
paul@100 | 104 | space name can be used to generate a complete mapping for a site.
|
paul@100 | 105 |
|
paul@100 | 106 | The following files are generated:
|
paul@100 | 107 |
|
paul@100 | 108 | * mapping-id-to-page.txt
|
paul@100 | 109 | * mapping-tiny-to-id.txt
|
paul@100 | 110 | * mapping-tiny-to-page.txt
|
paul@100 | 111 |
|
paul@100 | 112 | The most useful of these is the first as it includes all the necessary
|
paul@100 | 113 | information provided by the arbitrary mapping from identifiers to page names.
|
paul@100 | 114 | The second mapping merely converts the "tiny URLs" to identifiers, which can
|
paul@100 | 115 | be done by applying an algorithm without any external knowledge of the wiki
|
paul@100 | 116 | structure. The third mapping is provided as a convenience, combining the "tiny
|
paul@100 | 117 | URL" conversion and the arbitrary mapping to page names.
|
paul@100 | 118 |
|
paul@102 | 119 | Translating Requests Using the Mappings
|
paul@102 | 120 | ---------------------------------------
|
paul@102 | 121 |
|
paul@100 | 122 | Where Web server facilities such as RewriteMap are available for use, the
|
paul@100 | 123 | first and third mapping files can be used directly. See the Apache
|
paul@100 | 124 | documentation for details of RewriteMap:
|
paul@100 | 125 |
|
paul@100 | 126 | http://httpd.apache.org/docs/2.4/rewrite/rewritemap.html
|
paul@100 | 127 |
|
paul@100 | 128 | Otherwise, it is more likely that the first file is used by a program that can
|
paul@100 | 129 | perform a redirect to the appropriate wiki page, and the "tiny URL" decoding
|
paul@100 | 130 | is also done by this program when deployed in a suitable location to receive
|
paul@102 | 131 | such requests. To support this, the following resources are provided:
|
paul@102 | 132 |
|
paul@102 | 133 | * scripts/redirect.py
|
paul@102 | 134 | * config/mailmanwiki-redirect
|
paul@102 | 135 |
|
paul@102 | 136 | The latter configuration file should be combined with the Web server
|
paul@102 | 137 | configuration file such that the appropriate aliases are able to capture
|
paul@102 | 138 | requests and invoke the redirect.py script before the main wiki aliases are
|
paul@102 | 139 | consulted. The script itself should be placed in a suitable filesystem
|
paul@102 | 140 | location, and the mapping-id-to-page.txt file should be placed alongside it,
|
paul@102 | 141 | or it should be placed in a different location and the MAPPING_ID_TO_PAGE
|
paul@102 | 142 | variable changed in the script to refer to this different location.
|
paul@100 | 143 |
|
paul@104 | 144 | Identifying and Migrating Users
|
paul@104 | 145 | -------------------------------
|
paul@104 | 146 |
|
paul@104 | 147 | Confluence export archives do not contain user profile information, but page
|
paul@104 | 148 | versions are marked with user identifiers. Therefore, a list of user
|
paul@104 | 149 | identifiers can be obtained by running a script extracting these identifiers.
|
paul@104 | 150 | The following command writes to standard output the users involved with
|
paul@104 | 151 | editing the wiki in four different spaces (exported to four directories):
|
paul@104 | 152 |
|
paul@104 | 153 | tools/users.sh COM DEV DOC SEC
|
paul@104 | 154 |
|
paul@105 | 155 | This output can be edited and then passed to a program which fetches other
|
paul@105 | 156 | profile details as follows:
|
paul@104 | 157 |
|
paul@104 | 158 | tools/users.sh COM DEV DOC SEC > users.txt # for editing
|
paul@105 | 159 | cat users.txt | tools/get_profiles.py http://wiki.list.org/
|
paul@104 | 160 |
|
paul@104 | 161 | If no users are to be removed in migration, the following command could be
|
paul@104 | 162 | issued:
|
paul@104 | 163 |
|
paul@105 | 164 | tools/users.sh COM DEV DOC SEC | tools/get_profiles.py http://wiki.list.org/
|
paul@105 | 165 |
|
paul@105 | 166 | The get_profiles.py program needs to be told the URL of the original
|
paul@105 | 167 | Confluence site. Note that it accesses the site at a default rate of around
|
paul@105 | 168 | one request per second; a different delay between requests can be specified
|
paul@105 | 169 | using an additional argument.
|
paul@105 | 170 |
|
paul@105 | 171 | The output of the get_profiles.py program can be passed to another program
|
paul@105 | 172 | which adds users to MoinMoin, and so the following commands can be used:
|
paul@105 | 173 |
|
paul@105 | 174 | cat users.txt \
|
paul@105 | 175 | | tools/get_profiles.py http://wiki.list.org/ \
|
paul@105 | 176 | | tools/addusers.py wiki
|
paul@105 | 177 |
|
paul@105 | 178 | And using one single command:
|
paul@105 | 179 |
|
paul@105 | 180 | tools/users.sh COM DEV DOC SEC \
|
paul@105 | 181 | | tools/get_profiles.py http://wiki.list.org/ \
|
paul@105 | 182 | | tools/addusers.py wiki
|
paul@104 | 183 |
|
paul@104 | 184 | The addusers.py program needs to be told the directory containing the wiki
|
paul@105 | 185 | configuration.
|
paul@104 | 186 |
|
paul@30 | 187 | Output Structure
|
paul@30 | 188 | ----------------
|
paul@30 | 189 |
|
paul@30 | 190 | The structure of a converted workspace is a directory hierarchy containing the
|
paul@30 | 191 | following directories:
|
paul@30 | 192 |
|
paul@30 | 193 | * pages (a collection of directories defining each page or content item,
|
paul@30 | 194 | corresponding to Page, Comment and BlogPost elements in the XML
|
paul@30 | 195 | exported from Confluence)
|
paul@30 | 196 |
|
paul@30 | 197 | * versions (a collection of files, each defining a revision or version of
|
paul@30 | 198 | some content, corresponding to BodyContent elements in the XML
|
paul@30 | 199 | exported from Confluence)
|
paul@30 | 200 |
|
paul@30 | 201 | Each page directory contains the following things:
|
paul@30 | 202 |
|
paul@100 | 203 | * pagetype (either "Page", "Comment" or "BlogPost")
|
paul@100 | 204 |
|
paul@40 | 205 | * manifest (a list of version entries in a format similar to the MoinMoin
|
paul@40 | 206 | page package manifest format)
|
paul@30 | 207 |
|
paul@40 | 208 | * attachments (a list of attachment version entries in a format similar to
|
paul@40 | 209 | the MoinMoin page package manifest format)
|
paul@30 | 210 |
|
paul@40 | 211 | * pagetitle (an optional page title imposed on the page by another content
|
paul@40 | 212 | item)
|
paul@40 | 213 |
|
paul@40 | 214 | * children (a list of child page names defined for the page)
|
paul@30 | 215 |
|
paul@100 | 216 | * comments (a list of creation date plus comment page identifier pairs)
|
paul@100 | 217 |
|
paul@30 | 218 | In the output structure, content items such as comments are represented as
|
paul@30 | 219 | pages and each reference a content version. Since comments will ultimately be
|
paul@30 | 220 | represented as subpages of some parent page, they will have a pagetitle file
|
paul@30 | 221 | in their directory with an appropriate subpage name written according to the
|
paul@30 | 222 | parent page's name and comment details.
|
paul@30 | 223 |
|
paul@20 | 224 | Troubleshooting
|
paul@20 | 225 | ---------------
|
paul@20 | 226 |
|
paul@20 | 227 | The page package import activity in particular can be a source of problems.
|
paul@20 | 228 | Generally, any error occurring when attempting to import a package is likely
|
paul@20 | 229 | to be due to insufficient privileges when writing to the pages directory of a
|
paul@100 | 230 | wiki or to its edit-log file.
|
paul@20 | 231 |
|
paul@100 | 232 | The moinsetup software can generate scripts that set the ownership of wiki
|
paul@20 | 233 | files or apply ACLs (access control lists) to those files in order to make
|
paul@100 | 234 | access to wiki data more convenient. Where the ownership of the files must be
|
paul@20 | 235 | set (to www-data or nobody), the import step can be run as that user given
|
paul@20 | 236 | sufficient privileges. However, the easiest solution is to apply ACLs, thus
|
paul@100 | 237 | allowing the user who created the wiki to retain write access to it.
|
paul@20 | 238 |
|
paul@20 | 239 | Contact, Copyright and Licence Information
|
paul@20 | 240 | ------------------------------------------
|
paul@20 | 241 |
|
paul@20 | 242 | The current Web page for ConfluenceConverter at the time of release is:
|
paul@20 | 243 |
|
paul@20 | 244 | http://hgweb.boddie.org.uk/ConfluenceConverter
|
paul@20 | 245 |
|
paul@20 | 246 | Copyright and licence information can be found in the docs directory - see
|
paul@20 | 247 | docs/COPYING.txt and docs/LICENCE.txt for more information.
|