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@108 | 60 | In addition, extensions are provided in this distribution to support various
|
paul@108 | 61 | Confluence features, notably comments on pages. These extensions are installed
|
paul@108 | 62 | as follows:
|
paul@108 | 63 |
|
paul@108 | 64 | python moinsetup.py -m install_actions $CCDIR/actions
|
paul@108 | 65 | python moinsetup.py -m install_macros $CCDIR/macros
|
paul@108 | 66 | python moinsetup.py -m install_theme_resources $CCDIR
|
paul@108 | 67 | python moinsetup.py -m edit_theme_stylesheet screen.css includecomments.css
|
paul@108 | 68 | python moinsetup.py -m edit_theme_stylesheet print.css includecomments.css
|
paul@108 | 69 |
|
paul@118 | 70 | Additional Software
|
paul@118 | 71 | -------------------
|
paul@118 | 72 |
|
paul@118 | 73 | PDF export support requires the ExportPDF action:
|
paul@118 | 74 |
|
paul@118 | 75 | http://moinmo.in/ActionMarket/ExportPDF
|
paul@118 | 76 |
|
paul@118 | 77 | This in turn requires Apache FOP for PDF production using XSL-FO:
|
paul@118 | 78 |
|
paul@118 | 79 | http://xmlgraphics.apache.org/fop/
|
paul@118 | 80 |
|
paul@118 | 81 | (On Debian systems, the fop package provides this tool.)
|
paul@118 | 82 |
|
paul@118 | 83 | To produce XSL-FO from DocBook output, xsltproc is required from the libxslt
|
paul@118 | 84 | distribution:
|
paul@118 | 85 |
|
paul@118 | 86 | http://xmlsoft.org/XSLT/
|
paul@118 | 87 |
|
paul@118 | 88 | (On Debian systems, the xsltproc package provides this tool.)
|
paul@118 | 89 |
|
paul@118 | 90 | And DocBook output requires the DocBook resources to be installed, described
|
paul@118 | 91 | in the following guide:
|
paul@118 | 92 |
|
paul@118 | 93 | http://www.sagehill.net/docbookxsl/ToolsSetup.html
|
paul@118 | 94 |
|
paul@118 | 95 | (On Debian systems, the docbook-xsl package provides these resources.)
|
paul@118 | 96 |
|
paul@20 | 97 | Quick Start
|
paul@20 | 98 | -----------
|
paul@20 | 99 |
|
paul@100 | 100 | Given an XML export archive file for a Confluence wiki instance (in the
|
paul@100 | 101 | example below, the file is called COM-123456-789012.zip), the following
|
paul@100 | 102 | command can be used to prepare a page package for MoinMoin:
|
paul@20 | 103 |
|
paul@100 | 104 | python convert.py COM-123456-789012.zip COM
|
paul@20 | 105 |
|
paul@20 | 106 | In addition to the filename, a workspace name is required. Confluence appears
|
paul@20 | 107 | to require a workspace as a container for collections of pages, but this also
|
paul@100 | 108 | permits us to selectively import parts of a wiki into MoinMoin. If attachments
|
paul@100 | 109 | were included in the export from Confluence, these will be imported into the
|
paul@100 | 110 | page package.
|
paul@20 | 111 |
|
paul@20 | 112 | The result of the above command will be a directory having the same name as
|
paul@20 | 113 | the chosen workspace, together with a zip archive for that directory's
|
paul@20 | 114 | contents. Thus, the above command would produce a directory called COM and an
|
paul@20 | 115 | archive called COM.zip.
|
paul@20 | 116 |
|
paul@20 | 117 | To import the result, use moinsetup as follows:
|
paul@20 | 118 |
|
paul@20 | 119 | python moinsetup.py -m install_page_package COM.zip
|
paul@20 | 120 |
|
paul@20 | 121 | This requires a suitable moinsetup.cfg file in the working directory.
|
paul@20 | 122 |
|
paul@100 | 123 | Mappings from Identifiers to Pages
|
paul@100 | 124 | ----------------------------------
|
paul@100 | 125 |
|
paul@100 | 126 | Confluence uses numbers to label content revisions, and links to Confluence
|
paul@100 | 127 | sites sometimes use these numbers instead of a readable page name. MoinMoin,
|
paul@100 | 128 | meanwhile, only uses page names and has no external numeric identifier scheme.
|
paul@100 | 129 | Consequently, it is necessary to produce a mapping from Confluence identifiers
|
paul@100 | 130 | to MoinMoin page names. In addition to numeric identifiers, Confluence also
|
paul@100 | 131 | provides "tiny URLs" which are an alphanumeric encoding of the numeric
|
paul@100 | 132 | identifiers.
|
paul@100 | 133 |
|
paul@100 | 134 | To generate mappings for the Confluence content, use the mappings script as
|
paul@100 | 135 | follows:
|
paul@100 | 136 |
|
paul@103 | 137 | tools/mappings.sh COM
|
paul@100 | 138 |
|
paul@100 | 139 | Here, COM is a directory name containing converted Confluence content,
|
paul@100 | 140 | corresponding to a space name in the original Confluence wiki. More than one
|
paul@100 | 141 | space name can be used to generate a complete mapping for a site.
|
paul@100 | 142 |
|
paul@100 | 143 | The following files are generated:
|
paul@100 | 144 |
|
paul@100 | 145 | * mapping-id-to-page.txt
|
paul@100 | 146 | * mapping-tiny-to-id.txt
|
paul@100 | 147 | * mapping-tiny-to-page.txt
|
paul@100 | 148 |
|
paul@100 | 149 | The most useful of these is the first as it includes all the necessary
|
paul@100 | 150 | information provided by the arbitrary mapping from identifiers to page names.
|
paul@100 | 151 | The second mapping merely converts the "tiny URLs" to identifiers, which can
|
paul@100 | 152 | be done by applying an algorithm without any external knowledge of the wiki
|
paul@100 | 153 | structure. The third mapping is provided as a convenience, combining the "tiny
|
paul@100 | 154 | URL" conversion and the arbitrary mapping to page names.
|
paul@100 | 155 |
|
paul@102 | 156 | Translating Requests Using the Mappings
|
paul@102 | 157 | ---------------------------------------
|
paul@102 | 158 |
|
paul@100 | 159 | Where Web server facilities such as RewriteMap are available for use, the
|
paul@100 | 160 | first and third mapping files can be used directly. See the Apache
|
paul@100 | 161 | documentation for details of RewriteMap:
|
paul@100 | 162 |
|
paul@100 | 163 | http://httpd.apache.org/docs/2.4/rewrite/rewritemap.html
|
paul@100 | 164 |
|
paul@100 | 165 | Otherwise, it is more likely that the first file is used by a program that can
|
paul@100 | 166 | perform a redirect to the appropriate wiki page, and the "tiny URL" decoding
|
paul@100 | 167 | is also done by this program when deployed in a suitable location to receive
|
paul@102 | 168 | such requests. To support this, the following resources are provided:
|
paul@102 | 169 |
|
paul@102 | 170 | * scripts/redirect.py
|
paul@102 | 171 | * config/mailmanwiki-redirect
|
paul@102 | 172 |
|
paul@102 | 173 | The latter configuration file should be combined with the Web server
|
paul@102 | 174 | configuration file such that the appropriate aliases are able to capture
|
paul@102 | 175 | requests and invoke the redirect.py script before the main wiki aliases are
|
paul@102 | 176 | consulted. The script itself should be placed in a suitable filesystem
|
paul@102 | 177 | location, and the mapping-id-to-page.txt file should be placed alongside it,
|
paul@102 | 178 | or it should be placed in a different location and the MAPPING_ID_TO_PAGE
|
paul@102 | 179 | variable changed in the script to refer to this different location.
|
paul@100 | 180 |
|
paul@113 | 181 | Supporting Confluence Action URLs
|
paul@113 | 182 | ---------------------------------
|
paul@113 | 183 |
|
paul@113 | 184 | Besides the "viewpage" action mapping identifiers to pages (covered by the
|
paul@113 | 185 | mapping described above), some other action URLs may be used in wiki content
|
paul@113 | 186 | and must either be translated or supported using redirects. Since external
|
paul@113 | 187 | sites may also employ such actions, a redirect strategy perhaps makes more
|
paul@113 | 188 | sense. To support this, the following resources are involved:
|
paul@113 | 189 |
|
paul@114 | 190 | * scripts/dashboard.py
|
paul@118 | 191 | * scripts/redirect.py
|
paul@113 | 192 | * scripts/search.py
|
paul@113 | 193 | * config/mailmanwiki-redirect
|
paul@113 | 194 |
|
paul@113 | 195 | The latter configuration file is also involved in identifier-to-page mapping,
|
paul@118 | 196 | but in this case it causes requests to the "dashboard", "doexportpage" and
|
paul@118 | 197 | "dosearchsite" actions to be directed to the dashboard.py, redirect.py and
|
paul@118 | 198 | search.py scripts respectively.
|
paul@114 | 199 |
|
paul@114 | 200 | The dashboard.py script merely redirects requests to the root of the site,
|
paul@114 | 201 | thus assuming that the front page is configured to show dashboard-like
|
paul@114 | 202 | information.
|
paul@114 | 203 |
|
paul@118 | 204 | The redirect.py script, apart from supporting identifier-to-page redirects,
|
paul@118 | 205 | also supports PDF page exports since the "doexportpage" action uses
|
paul@118 | 206 | identifiers to indicate which page is to be exported.
|
paul@118 | 207 |
|
paul@114 | 208 | The search.py script redirects search requests in a suitable form to the
|
paul@114 | 209 | MoinMoin "fullsearch" action.
|
paul@113 | 210 |
|
paul@104 | 211 | Identifying and Migrating Users
|
paul@104 | 212 | -------------------------------
|
paul@104 | 213 |
|
paul@104 | 214 | Confluence export archives do not contain user profile information, but page
|
paul@104 | 215 | versions are marked with user identifiers. Therefore, a list of user
|
paul@104 | 216 | identifiers can be obtained by running a script extracting these identifiers.
|
paul@104 | 217 | The following command writes to standard output the users involved with
|
paul@104 | 218 | editing the wiki in four different spaces (exported to four directories):
|
paul@104 | 219 |
|
paul@104 | 220 | tools/users.sh COM DEV DOC SEC
|
paul@104 | 221 |
|
paul@105 | 222 | This output can be edited and then passed to a program which fetches other
|
paul@105 | 223 | profile details as follows:
|
paul@104 | 224 |
|
paul@104 | 225 | tools/users.sh COM DEV DOC SEC > users.txt # for editing
|
paul@105 | 226 | cat users.txt | tools/get_profiles.py http://wiki.list.org/
|
paul@104 | 227 |
|
paul@104 | 228 | If no users are to be removed in migration, the following command could be
|
paul@104 | 229 | issued:
|
paul@104 | 230 |
|
paul@105 | 231 | tools/users.sh COM DEV DOC SEC | tools/get_profiles.py http://wiki.list.org/
|
paul@105 | 232 |
|
paul@105 | 233 | The get_profiles.py program needs to be told the URL of the original
|
paul@105 | 234 | Confluence site. Note that it accesses the site at a default rate of around
|
paul@105 | 235 | one request per second; a different delay between requests can be specified
|
paul@105 | 236 | using an additional argument.
|
paul@105 | 237 |
|
paul@105 | 238 | The output of the get_profiles.py program can be passed to another program
|
paul@105 | 239 | which adds users to MoinMoin, and so the following commands can be used:
|
paul@105 | 240 |
|
paul@105 | 241 | cat users.txt \
|
paul@105 | 242 | | tools/get_profiles.py http://wiki.list.org/ \
|
paul@105 | 243 | | tools/addusers.py wiki
|
paul@105 | 244 |
|
paul@105 | 245 | And using one single command:
|
paul@105 | 246 |
|
paul@105 | 247 | tools/users.sh COM DEV DOC SEC \
|
paul@105 | 248 | | tools/get_profiles.py http://wiki.list.org/ \
|
paul@105 | 249 | | tools/addusers.py wiki
|
paul@104 | 250 |
|
paul@104 | 251 | The addusers.py program needs to be told the directory containing the wiki
|
paul@105 | 252 | configuration.
|
paul@104 | 253 |
|
paul@30 | 254 | Output Structure
|
paul@30 | 255 | ----------------
|
paul@30 | 256 |
|
paul@30 | 257 | The structure of a converted workspace is a directory hierarchy containing the
|
paul@30 | 258 | following directories:
|
paul@30 | 259 |
|
paul@30 | 260 | * pages (a collection of directories defining each page or content item,
|
paul@30 | 261 | corresponding to Page, Comment and BlogPost elements in the XML
|
paul@30 | 262 | exported from Confluence)
|
paul@30 | 263 |
|
paul@30 | 264 | * versions (a collection of files, each defining a revision or version of
|
paul@30 | 265 | some content, corresponding to BodyContent elements in the XML
|
paul@30 | 266 | exported from Confluence)
|
paul@30 | 267 |
|
paul@30 | 268 | Each page directory contains the following things:
|
paul@30 | 269 |
|
paul@100 | 270 | * pagetype (either "Page", "Comment" or "BlogPost")
|
paul@100 | 271 |
|
paul@40 | 272 | * manifest (a list of version entries in a format similar to the MoinMoin
|
paul@40 | 273 | page package manifest format)
|
paul@30 | 274 |
|
paul@40 | 275 | * attachments (a list of attachment version entries in a format similar to
|
paul@40 | 276 | the MoinMoin page package manifest format)
|
paul@30 | 277 |
|
paul@40 | 278 | * pagetitle (an optional page title imposed on the page by another content
|
paul@40 | 279 | item)
|
paul@40 | 280 |
|
paul@40 | 281 | * children (a list of child page names defined for the page)
|
paul@30 | 282 |
|
paul@100 | 283 | * comments (a list of creation date plus comment page identifier pairs)
|
paul@100 | 284 |
|
paul@30 | 285 | In the output structure, content items such as comments are represented as
|
paul@30 | 286 | pages and each reference a content version. Since comments will ultimately be
|
paul@30 | 287 | represented as subpages of some parent page, they will have a pagetitle file
|
paul@30 | 288 | in their directory with an appropriate subpage name written according to the
|
paul@30 | 289 | parent page's name and comment details.
|
paul@30 | 290 |
|
paul@20 | 291 | Troubleshooting
|
paul@20 | 292 | ---------------
|
paul@20 | 293 |
|
paul@20 | 294 | The page package import activity in particular can be a source of problems.
|
paul@20 | 295 | Generally, any error occurring when attempting to import a package is likely
|
paul@20 | 296 | to be due to insufficient privileges when writing to the pages directory of a
|
paul@100 | 297 | wiki or to its edit-log file.
|
paul@20 | 298 |
|
paul@100 | 299 | The moinsetup software can generate scripts that set the ownership of wiki
|
paul@20 | 300 | files or apply ACLs (access control lists) to those files in order to make
|
paul@100 | 301 | access to wiki data more convenient. Where the ownership of the files must be
|
paul@20 | 302 | set (to www-data or nobody), the import step can be run as that user given
|
paul@20 | 303 | sufficient privileges. However, the easiest solution is to apply ACLs, thus
|
paul@100 | 304 | allowing the user who created the wiki to retain write access to it.
|
paul@20 | 305 |
|
paul@20 | 306 | Contact, Copyright and Licence Information
|
paul@20 | 307 | ------------------------------------------
|
paul@20 | 308 |
|
paul@20 | 309 | The current Web page for ConfluenceConverter at the time of release is:
|
paul@20 | 310 |
|
paul@20 | 311 | http://hgweb.boddie.org.uk/ConfluenceConverter
|
paul@20 | 312 |
|
paul@20 | 313 | Copyright and licence information can be found in the docs directory - see
|
paul@20 | 314 | docs/COPYING.txt and docs/LICENCE.txt for more information.
|