Importing a MoinMoin Wiki into a Deki Wiki
Submitted by Kevin Kleinfelter on Mon, 2007-11-26 14:05.
I'm contemplating switching my wikis from MoinMoin to Deki. In order to be able to do this, I need to import MoinMoin pages and attachments into Deki.
What my scripts will do:
- Import MoinMoin pages into Deki.
- Import MoinMoin attachments into Deki.
- Import MoinMoin users into Deki.
- Create a mail-new-pw shell script you can run to notify all users of their user-ID and password on the new wiki.
Known limitations:
- All page text is imported, but it may look a little different in Deki than in Moin.
- All attachments and embedded images will be moved to the end of their respective pages, and the embedded references to them will be changed to a message directing the user to the attachments at the end of the page.
- Embedded URLs will not be rewritten. This means that if your wiki is hosted at wiki.example.com, an url such as http://wiki.example.com/SomePage/Attached.file will NOT be adjusted to reference the relocated attachment.
- Users will be imported, but passwords will not. The Deki password 'recovery' process is available to users to gain access to their migrated account, as well as the email-password script generated by this upgrade process.
Prerequisites:
- A Deki wiki (can be empty).
- A MoinMoin wiki.
- A Windows PC with
- Python 2.5
- MoinMoin 1.5.8
- Cygwin
- The instructions below assume that you have a MoinMoin wiki at www.example.com, that you've been evaluating Deki at wiki.example.com, and that you want your new wiki to be available at www.example.com.
- Patience!
It does all the Deki I/O via curl, so you can use it for samples of the curl commands for:
- Authorization (login)
- Page creation
- Subpage creation
- User creation
- Attachments
Please note: I prefer to keep these instructions on my site, and that people download the scripts via this page. That way, there is a slight chance that I'll pick up some extra cents from the ads.
Step-by-step instructions:
- Download my scripts to a Windows PC, and unzip them into a directory.
- Download the MoinMoin data directory to a Windows PC.
- Shut down your MoinMoin wiki and bring up your new Deki wiki at the old URL.
- Edit your httpd.conf:
- Comment out your MoinMoin VirtualHost at www.example.com.
- Locate your entry for wiki.example.com, and change its server name to use www instead of wiki.
- Restart Apache
- Make sure your (possibly empty) Deki wiki works at the new URL.
- Edit myoptions.py to contain values relevant to your Deki wiki.
- Note: You may wish to create a special wiki user ID named something like "imported-from-old-wiki".
- From a CMD prompt, run: python builder.py C:\path\to\your\wiki\data-directory
- You now have a 'listfiles' subdirectory, containing content that is ready for importing into Deki, plus a 'load2deki.sh' shell script.
- From a Cygwin prompt, run: bash load2deki.sh
- Your pages have been loaded into your Deki wiki. Note that it is safe to re-run this script, if needed. It will overwrite any previous editions of the pages.
- From a CMD prompt, run: python builder2.py C:\path\to\your\wiki\data-directory
- From a Cygwin prompt, run: bash load2deki2.sh
- Your attachments have been loaded into your Deki wiki.
- From a CMD prompt, run: python builder3.py C:\path\to\your\wiki\data-directory
- From a Cygwin prompt, run: bash load2deki3.sh
- Your users have been loaded into your Deki Wiki.
- Optional: Run mail-new-pw.sh on a server that supports the Unix/Linux 'mail' command. This will send email to each of your users, with their new ID/password.
| Attachment | Size |
|---|---|
| moin2deki.zip | 11.32 KB |

Delicious
Digg
Reddit
Wonderful!
This is great Kevin! If you like you can add this to the Deki Wiki FAQ. To assist, I already copy/pasted the page over and gave you credit you can find it here. All that's needed is the scripts, assuming you want to make them public. If you're not interested you're certainly not obliged to do so, no worries, I can delete the page.
Again, thanks! This is wonderful. There have been many requests for a MoinMoin to Deki Wiki migration tool. MindTouch will be releasing a Mediawiki to Deki Wiki migration tool Q1 of 2008.
I prefer to keep these
I prefer to keep these instructions on my site, and that people
download the scripts via this page. That way, there is a slight chance
that I'll pick up some extra cents from the ads.
NP
NP, thanks for working this out. I know many others will appreciate this.
unicode version of moin2html.py
Thank you for your great job. I tried for Korean and found some hacks and modified. This works fine for me.
Add following import line
import codecs
Mofify end part as follows
# read file to unicode string
FILE = codecs.open(sys.argv[2], "r", "utf-8")
s = FILE.read()
FILE.close()
req.cfg.data_dir = sys.argv[1]
req.text = s.replace(u"\x0a\x0d", u"\x0a")
parser.format(formatter)
exit(0)
Thanks for the info. I'm
Thanks for the info. I'm sure that other non-ASCII users will find it valuable.
Kevin
unicode patch 2 - I missed something
Line 156 must be changed.
sys.stdout.write(str) -> sys.stdout.write(str.encode('utf-8'))
I use #python builder.py
I use
#python builder.py <data directory>
Traceback (most recent call last):
File "moin2html.py", line 248, in ?
exit(0)
TypeError: 'str' object is not callable
what can i do?
I use that way #python
I use that way
#python builder.py <data directory>
Traceback (most recent call last):
File "moin2html.py", line 248, in ?
exit(0)
TypeError: 'str' object is not callable
what can I do?
Better support for non ascii
Hi!
The above utf-8 stuff is good, so I added it. But the requouting of page titles is to basic and screws up non ascii titles. Better use this Titleize:
cre=re.compile('(?:\(((?:[0-9a-f][0-9a-f])+)\))?([^(]+)',re.I) sre=re.compile('..') def Titleize(s): s2='' for special, normal in cre.findall(s): for byte in sre.findall(special.upper()): s2+='%25'+byte s2+=normal s2 = s2.replace(' ', '%2520') # 20 is ' ' s2 = s2.replace('+', '%252b') # 2b is '+' return s2In addition Hayes 1.8.3c needs a different Content-type to be set. Change the line in ProcessDir to
Hope that helps other non-ascii users :)
Oliver.
use: sys.exit(0)
use:
sys.exit(0)
Traceback error
Hi!
Noob issue here (sorry)
when I run the builder.py I point it to my moinmoin data directory and while it "sees" the data it reports and error on every page. I also note that the loadfiles and load2deki.sh script are create, however, all the html files in the loadfiles folder a of zero size.
Error as noted below
---
Traceback (most recent call last):
File "moin2html.py", line 22, in <module>
import MoinMoin.parser.wiki
ImportError: No Module named moinmoin.parser.wiki
---
This looked obvious to me at first and then I found that I couldn't find where I needed to grab the "module" from.
Please can someone help me with this?
Notes
-DekiWiki up and running
-moinmoin running (but on different server) with data copied to current machine (incidentally tried running the scripts on the moinmoin server on a copy of the data with the same results)
-Python functioning
-Cycwin functioning
In much anticipation!
Shawn
I'm doing something wrong I rekon!
Hi!
Noob issue here (sorry)
when I run the
builder.py I point it to my moinmoin data directory and while it "sees"
the data it reports and error on every page. I also note that the
loadfiles and load2deki.sh script are create, however, all the html
files in the loadfiles folder a of zero size.
Error as noted below
---
Traceback (most recent call last):
File "moin2html.py", line 22, in <module>
import MoinMoin.parser.wiki
ImportError: No Module named moinmoin.parser.wiki
---
This looked obvious to me at first and then I found that I couldn't find where I needed to grab the "module" from.
Please can someone help me with this?
Notes
-DekiWiki up and running
-moinmoin
running (but on different server) with data copied to current machine
(incidentally tried running the scripts on the moinmoin server on a
copy of the data with the same results)
-Python functioning
-Cycwin functioning
In much anticipation!
Shawn
You Need Moin
You are going to have to install MoinMoin on the machine where you want to run the conversion. The conversion calls on MoinMoin modules to render your MoinMoin data into HTML, which is what you will eventually upload to Deki.
Linux users
can't your script run under linux?? if the paths are adapted!
Can you provide a Linux version?
It has been awhile since I
It has been awhile since I used the scripts, so my memory is fuzzy on the details. Since it is python, it should be possible to make it run on Linux without too much effort. The Python is nearly trivial, so updating them to meet your needs shouldn't take too much of your time. (I'm a lightweight, when it comes to Python.)
I wrote them to move a Moin wiki to a Deki wiki, and I've got too much (paying) work to have the time to adapt them to other environments, now that I've moved my data.
Again, my memory is a little fuzzy, but I think it moved all pages to be top-level pages in the target wiki, making them all appear in the left side panel.