Upgrade to MediaWiki

MediaWiki is a completely different wiki to the previous one, but thanks to css you can hardly tell the difference.

Brief overview of new features and changes:

  • Categories
  • .. hundreds of improvements
  • MediaWiki is still in development so we have a upgrade path
  • MySQL based, scaleable
  • Uploads are found on Special page
  • Note that CamelCase words are no longer automatically a link.

Sorry, but you’ll have to register your usernames again.

Note that when you register, a page named User:Yourname will be created. This is now the normal place for your own page on the wiki.

If you like, redirect your old page to your new user page by replacing it with a redirect such as:

 #REDIRECT [[User:Yourname]]

Completed:

  • Database conversion
  • Creation of styles
  • mod_redirects
  • switchover

Hypno 02:26, 2 Nov 2004 (GMT)

 

 Database conversion

There is some documentation about upgrading in the UPGRADE file distributed with MediaWiki.

To follow on from those, this is how I upgraded from usemod to MediaWiki:

Because MediaWiki does not automatically link to CamelCase style links, you will need to add brackets [[ ]] to all your links. I did this with the following:

First, obtain ImportStage1.txt (or whatever you want to call it) from the importMediaWiki.php script ( use > to pipe the output to a file )

Second, do

sed '/Importing/!s/\ [A-Z]\w*[a-z]\w*[A-Z]\w*[a-zA-Z]/\ \[\[&\]\] /g' ImportStage1.txt > ImportStage2.txt

This should create proper links in place of your CamelCase links.

This doesn’t work so well for SubPage links – someone care to fix?

Doesn’t work so well for pages with numbers in the name either
–Aimaz 12:58, 4 Nov 2004 (GMT)

Then,

 
sed 's/upload\:\w*\.\w*/http\:\/\/aberwiki\.org\/uploads\/& /g' ImportStage2.txt > ImportStage3.txt

This fixes your upload links. Change the replace text so it fills in your url such as http://www.yourwiki.org/uploads/filename

You are now ready to import ImportStage3.txt into your database with a command such as

mysql -u<mysqluser> -p<yourpass> <db name> < ImportStage3.txt

(this is a duplicate of content I have added to http://meta.wikimedia.org/wiki/MediaWiki_FAQ#Can_I_upgrade_from_other_types_of_wiki.3F

 

 Apache redirects

With these apache directives, links to old usemod type pages (http://wiki.ivixor.net/aw.pl?PageName, et al) still work, but the viewer is redirected to the new page. This has the effect of forcing a url change on indexes like google.

 RewriteEngine On

        #RewriteLog "/var/log/apache2/rewrite.log"
        #RewriteLogLevel 9

        #Redirect old  urls

        RewriteRule ^/aw.pl?(.*)$ /%{QUERY_STRING} [R]
        RewriteRule ^/aw2.pl?(.*)$ /%{QUERY_STRING} [R]
        RewriteCond %{QUERY_STRING} ^..*
        RewriteCond %{REQUEST_URI} !^/\?.*
        RewriteRule ^/$ /%{QUERY_STRING} [R]
        # end backward compatibility rules, the following ones are important
        # Don't rewrite requests for files in MediaWiki subdirectories,
        # MediaWiki PHP files, HTTP error documents, favicon.ico, or robots.txt
        RewriteCond %{REQUEST_URI} !^/(stylesheets|images|upload|uploads|skins|action)/
        # old blah.pl?action=huh links should 404
        RewriteCond %{QUERY_STRING} !^action\=.*
        RewriteCond %{REQUEST_URI} !^/(redirect|texvc|index).php
        RewriteCond %{REQUEST_URI} !^/error/(40(1|3|4)|500).html
        RewriteCond %{REQUEST_URI} !^/favicon.ico
        RewriteCond %{REQUEST_URI} !^/robots.txt

        #Rewrite http://wiki.domain.tld/article properly, this is the main rule
        RewriteRule ^/(.*)$ /index.php/$1 [L,QSA]