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