<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BigSmoke &#187; MediaWiki</title>
	<atom:link href="http://blog.bigsmoke.us/tag/mediawiki/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.bigsmoke.us</link>
	<description>Smokes your problems, coughs fresh air.</description>
	<lastBuildDate>Sat, 04 Feb 2012 18:03:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MediaWiki ConfirmEdit/QuestyCaptcha extension</title>
		<link>http://blog.bigsmoke.us/2012/01/17/mediawiki-questycaptcha</link>
		<comments>http://blog.bigsmoke.us/2012/01/17/mediawiki-questycaptcha#comments</comments>
		<pubDate>Tue, 17 Jan 2012 13:43:44 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[CAPTCHA]]></category>
		<category><![CDATA[ConfirmEdit]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[PALDAP]]></category>
		<category><![CDATA[QuestyCaptcha]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=2039</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Since I moved my <a href="http://www.paldap.org/">LDAP wiki</a> over from DokuWiki to MediaWiki, I&#8217;ve been burried by a daily torrent of spam. Just like with my <a href="http://wiki.hardwood-investments.net/">tropical timber investments wiki</a>, the ReCaptcha extension (with pretty intrusive settings) doesn&#8217;t seem to do much to stop this shitstream.</p>
<p>How do the spammers do this? Do they primarily trick visitors of other websites into solving this captchas for them or do they employ spam-sweatshops in third-world countries? Fuck them! I&#8217;m trying something new.</p>
<p>I&#8217;ve upgraded to the <a href="http://www.mediawiki.org/wiki/Extension:ConfirmEdit">ConfirmEdit extension</a>. (ReCaptcha has also moved into this extension.) This allows me to try different Captcha types. The one I was most interested in is QuestyChaptcha, which allows me to define a set of questions which the user needs to answer. I&#8217;m now trying it out with the following question:</p>
<p><pre class="php"><span style="color: #0000ff;">$wgCaptchaQuestions</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'question'</span> =&gt; <span style="color: #ff0000;">&quot;LDAP stands for ...&quot;</span>, <span style="color: #ff0000;">'answer'</span> =&gt; <span style="color: #ff0000;">&quot;Lightweight Directory Access Protocol&quot;</span> <span style="color: #66cc66;">&#41;</span>;</pre></p>
<p>I don&#8217;t think it&#8217;s a particularly good question, since it&#8217;s incredibly easy to Google. But, we&#8217;ll see, and in the mean time I&#8217;ll try to come up with one or two questions that are context-sensitive, yet easy enough to answer for anyone with some knowledge of LDAP. If you have an idea, please leave a comment. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2012/01/17/mediawiki-questycaptcha/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make a wiki work: PALDAP</title>
		<link>http://blog.bigsmoke.us/2011/01/14/wikiwork-paldap</link>
		<comments>http://blog.bigsmoke.us/2011/01/14/wikiwork-paldap#comments</comments>
		<pubDate>Thu, 13 Jan 2011 23:57:50 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[advertising]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[PALDAP]]></category>
		<category><![CDATA[Semantic MediaWiki]]></category>
		<category><![CDATA[traffic]]></category>
		<category><![CDATA[wiki]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1812</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>The first ever wiki I started was <a href="http://www.paldap.org/">www.paldap.org</a>. PALDAP stands for “PALDAP: A Lazy Directory Administrator&#8217;s Pal”. Yes, that&#8217;s a recursive acronym. Cute, ainnit? I actually registered the domain because it was the name of a crappy abandonware PHP LDAP administration tool that I wrote in PHP, but decided instead to configure it as a wiki to host some of my assorted experiences with LDAP and OpenLDAP in particular.</p>
<p>I never much bother with LDAP anymore, but the wiki remains because cool URLs don&#8217;t change and it doesn&#8217;t cost me that much. AdSense income for the wiki is only marginal (€15 in over three years) because the wiki&#8217;s content is only marginally useful and the traffic (300 visitors/month) reflects that fact.</p>
<p>[…]</p>
<p>Six days passed since I wrote the last paragraph. It&#8217;s a funny thing how writing can mess with your head. I was going to use PALDAP as in introduction to my struggle to make money of my wikis in general. Because the most promising of these wikis are my Hardwood Wikis and <em>not</em> my LDAP wiki, I wasn&#8217;t going to linger too much on it. But it&#8217;s a week later and some unexpected things happened.</p>
<p>Often, since becoming more familiar with <a href="http://semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic MediaWiki</a>, I&#8217;ve been considering the idea of converting the DokuWiki installation that runs www.paldap.org to a Semantic MediaWiki installation. Yet, nothing ever happened. I no longer work with LDAP professionally and most of the time I just kind of forgot that the site even existed. Until a week ago, when I started writing this post.</p>
<p>So, what happened? How <em>do</em> decisions happen? I have no idea. I&#8217;m not a neurologist. (I&#8217;m not even a <del>sceintist</del>; Hell, I can&#8217;t even <em>spell</em> “scientist”.)</p>
<p>What I have now are rationalizations for my decision but my decision is quite clear: I can&#8217;t kill my darling, even though I never really properly cared for it. For the last four years or so I had simply abandoned it on the grounds that it wasn&#8217;t costing me much anyway (it&#8217;s hosted at NearlyFreeSpeech.Net). Yes, the costs have gone up, but that&#8217;s just a rationalization. I could have just gone on and ignore the site&#8217;s existence without it ever making much of an impact on my cash flow. (I <em>did</em> some years ago actually promise the site&#8217;s most active contributer to never take the site off-line.)</p>
<p>So, if I was being rational, I would have just left the site alone. But, I&#8217;m not a rational being. Increasingly less so, in fact. A happy fact, if you ask me.</p>
<div id="attachment_1820" class="wp-caption alignright" style="width: 310px"><img src="http://blog.bigsmoke.us/uploads/2011/01/paldap-logo.jpg" alt="PALDAP logo" title="PALDAP logo" width="300" height="300" class="size-full wp-image-1820" /><p class="wp-caption-text">The PALDAP logo designed by Jeroen Dekker</p></div>
<h2>The looks</h2>
<p>Anyway, I still haven&#8217;t told you what happened last week. I didn&#8217;t leave the site alone. I created a development version of the site based on Semantic MediaWiki. It&#8217;s fucking kick-ass. It looks awesome thanks to MediaWiki&#8217;s new vector skin. But it looks even more awesome thanks to <a href="http://jeroendekker.com/">Jeroen Dekker</a>. As we often do, we were hanging out at his place in a lazy haze, being generally unproductive but with random bursts of intelligent conversation and productivity. This day I had been absent-mindedly hacking away on my new MediaWiki darling and I was about to leave and jump on my bicycle when I mentioned that I could use a logo for PALDAP.</p>
<p>It was probably way past one in the morning already, but Jeroen was still in a creative mood from play-practicing with his new lighting set. All I can say about his creativity is that it was late, I hadn&#8217;t slept very long the night before (and the night before that and the night before and…) Let&#8217;s just say that he besides his excellent gear he didn&#8217;t have some very good material to work with. I was feeling ugly and tired. Yet…</p>
<div id="attachment_1821" class="wp-caption alignleft" style="width: 310px"><a href="http://blog.bigsmoke.us/uploads/2011/01/mijnheer-molen-1024.jpg"><img src="http://blog.bigsmoke.us/uploads/2011/01/mijnheer-molen-1024-300x300.jpg" alt="Rowan, Januari 7, 2010" title="Rowan, Januari 7, 2010" width="300" height="300" class="size-medium wp-image-1821" /></a><p class="wp-caption-text">Jeroen's creative genius is a compliment to my awesome facial features <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p></div>
<p>He went into a kind of frenzy on his big-ass touch-screen and being coaxed by me he created the perfect offset for the boring technical subject that is LDAP.</p>
<h2>The brains</h2>
<p>In the meantime, since last weekend, I&#8217;ve been starting to assemble a logical structure of semantic properties (think of LDAP attributes or SQL fields) and templates (sort of like MediaWiki functions) that&#8217;ll allow me to capture all the semantics related to the LDAP and the ecology around it.</p>
<h2>The booty</h2>
<p>I still don&#8217;t believe that PALDAP has a huge revenue potential, but hosting costs have increased and if I can get the website to awaken from its winter sleep, maybe it&#8217;ll at least start paying for itself again. Not that I really care, honestly. Somehow it&#8217;s just masturbatorily satisfying to use the expressiveness of RDF to capture the semantics of LDAP. What I like about it is that the wiki concept (and especially the semantic wiki concept) is a very tight fit for technical documentation. Another thing that I like about working with a wiki about a technical subject is that the wiki has a technical audience. I mean, there&#8217;s a reason that the visitors of my Hardwood Investment Wikis click on all those expensive links and that reason is not the technical insight that&#8217;ll lead to users clicking the edit button and actually contributing content.</p>
<p>In fact, even with the old DokuWiki version of the site, much of the content was actually created by other users (most by the same user called brontolo). If the community of my Hardwood Wikis worked this well… Let&#8217;s just say that I could remain in retirement for a while then.</p>
<p>So, even if this&#8217;ll just be an exercise in effective community building/plumbing rather than a way to make advertising income easily, it&#8217;ll still be effective as an exercise. I&#8217;m going to follow my intuition on this one and see how successful it&#8217;ll become and how much time it&#8217;ll take.</p>
<p>Fuck, this post sucks, but it sure does help me. Don&#8217;t ask me how, but it does. Kinda.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2011/01/14/wikiwork-paldap/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MediaWiki Semantic Google Maps and Semantic Layers merged into one</title>
		<link>http://blog.bigsmoke.us/2010/03/07/mediawiki-semantic-maps</link>
		<comments>http://blog.bigsmoke.us/2010/03/07/mediawiki-semantic-maps#comments</comments>
		<pubDate>Sun, 07 Mar 2010 18:48:13 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[semantic]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1312</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>While upgrading my <a href="http://www.mediawiki.org/">MediaWiki</a> installation, I noticed that my trusted, old <a href="http://www.mediawiki.org/wiki/Extension:Semantic_Google_Maps">Semantic Google Maps</a> has been replaced by what seems to be the successor of what I considered the promising <a href="http://www.mediawiki.org/wiki/Extension:Semantic_Layers">Semantic Layers</a> extension. The new extension is simply called <a href="http://www.mediawiki.org/wiki/Extension:Semantic_Maps"><i>Semantic Maps</i></a>.</p>

]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/03/07/mediawiki-semantic-maps/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MediaWiki thumb.php and rewrite rules</title>
		<link>http://blog.bigsmoke.us/2010/03/07/mediawiki-thumb.php-rewrite-rules</link>
		<comments>http://blog.bigsmoke.us/2010/03/07/mediawiki-thumb.php-rewrite-rules#comments</comments>
		<pubDate>Sun, 07 Mar 2010 18:40:26 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[thumbnail]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=516</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>May, last year, I created an empty draft for this post, because, around that time, I had gone through quite some effort before I got thumbnails for foreign file repos working just right. Now, I&#8217;m taking a dive into my MediaWiki working dirs in preparation of the creation of a separate development environment, so it&#8217;s a good moment to rehash the past experience (almost as good as when I&#8217;d have done it right away).</p>

<p>This is how I configured the <a href="http://www.mediawiki.org/wiki/Manual:$wgForeignFileRepos">foreign file repo</a> to be able to use images uploaded to the English wiki from the Dutch wiki:</p>

<pre class="php"><span style="color: #0000ff;">$wgHashedUploadDirectory</span> = <span style="color: #000000; font-weight: bold;">false</span>;
&nbsp;
<span style="color: #0000ff;">$wgForeignFileRepos</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span>
    <span style="color: #ff0000;">'class'</span> =&gt; <span style="color: #ff0000;">'ForeignDBRepo'</span>,
    <span style="color: #ff0000;">'name'</span> =&gt; <span style="color: #ff0000;">'en'</span>,
    <span style="color: #ff0000;">'url'</span> =&gt; <span style="color: #ff0000;">&quot;http://wiki.hardwood-investments.net/media&quot;</span>,
    <span style="color: #ff0000;">'hashLevels'</span> =&gt; <span style="color: #cc66cc;">0</span>,
    <span style="color: #808080; font-style: italic;">//'thumbScriptUrl' =&gt; &quot;http://wiki.hardwood-investments.net/thumb.php&quot;,</span>
    <span style="color: #ff0000;">'transformVia404'</span> =&gt; <span style="color: #000000; font-weight: bold;">true</span>,<span style="color: #808080; font-style: italic;">//!$wgGenerateThumbnailOnParse,</span>
    <span style="color: #ff0000;">'dbType'</span> =&gt; <span style="color: #0000ff;">$wgDBtype</span>,
    <span style="color: #ff0000;">'dbServer'</span> =&gt; <span style="color: #0000ff;">$wgDBserver</span>,
    <span style="color: #ff0000;">'dbUser'</span> =&gt; <span style="color: #0000ff;">$wgDBuser</span>,
    <span style="color: #ff0000;">'dbPassword'</span> =&gt; <span style="color: #0000ff;">$wgDBpassword</span>,
    <span style="color: #ff0000;">'dbName'</span> =&gt; <span style="color: #ff0000;">'hardwood'</span>,
    <span style="color: #ff0000;">'tablePrefix'</span> =&gt; <span style="color: #ff0000;">'mw_'</span>,
    <span style="color: #ff0000;">'hasSharedCache'</span> =&gt; <span style="color: #000000; font-weight: bold;">false</span>,
    <span style="color: #ff0000;">'descBaseUrl'</span> =&gt; <span style="color: #ff0000;">'http://wiki.hardwood-investments.net/Image:'</span>,
    <span style="color: #ff0000;">'fetchDescription'</span> =&gt; <span style="color: #000000; font-weight: bold;">false</span>
<span style="color: #66cc66;">&#41;</span>;</pre>

<p>To make thumbnails be generated by <a href="http://www.mediawiki.org/wiki/Manual:Thumb.php"><tt>thumb.php</tt></a> on request I added the following to my <tt>.htaccess</tt> at the other end (and visa versa, because the Dutch wiki actually contains most of the images):</p>

<pre class="php">RewriteCond %<span style="color: #66cc66;">&#123;</span>REQUEST_FILENAME<span style="color: #66cc66;">&#125;</span> !-f
RewriteCond %<span style="color: #66cc66;">&#123;</span>REQUEST_FILENAME<span style="color: #66cc66;">&#125;</span> !-d
RewriteRule ^media/thumb/<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>^/<span style="color: #66cc66;">&#93;</span>+<span style="color: #66cc66;">&#41;</span>/<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #cc66cc;">-9</span><span style="color: #66cc66;">&#93;</span>+<span style="color: #66cc66;">&#41;</span>px-.*$ /thumb.php?f=$<span style="color: #cc66cc;">1</span>&amp;width=$<span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#91;</span>L,QSA<span style="color: #66cc66;">&#93;</span></pre>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/03/07/mediawiki-thumb.php-rewrite-rules/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tracking MediaWiki in a Subversion vendor branch</title>
		<link>http://blog.bigsmoke.us/2009/07/20/svn-vendor-branches</link>
		<comments>http://blog.bigsmoke.us/2009/07/20/svn-vendor-branches#comments</comments>
		<pubDate>Mon, 20 Jul 2009 12:33:44 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=672</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Vendor branches are the proper™ way of merging upstream changes in your web application installations. In Subversion, <a href="http://svnbook.red-bean.com/en/1.4/svn.advanced.vendorbr.html">managing vendor branches</a> isn&#8217;t so easy as it is in Git. Still, vendor branches make it much easier to track upstream.</p> 

<p>From before I first deployed the <a href="http://wiki.omega-research.org/Main_Page">Omega Research Wiki</a>, I already used svn to track changes to my MediaWiki installation. However, for upgrading from one upstream release to the next, I <a href="http://blog.bigsmoke.us/2008/03/13/upgrading-web-apps-with-diff-and-patch">used diff and patch</a>. This isn&#8217;t the most reliable of methods as is exemplified by doing a diff comparing a fresh MediaWiki download with the actual files in my repo (which are supposed to belong to the same version).</p>

<p>What&#8217;s basically a shortcoming of svn is that I can&#8217;t just say:</p>

<pre class="bash">svn merge http://svn.wikimedia.org/svnroot/mediawiki/tags/REL1_15_0/phase3/ \
http://svn.wikimedia.org/svnroot/mediawiki/tags/REL1_15_1/phase3/ .</pre>

<p>This would have been incredibly helpful, because now I&#8217;m keeping a vendor branch not because of local modifications to upstream, but just to be able to merge cleanly.</p>

<p>In Subversion, maintaining a vendor branch by hand is quite some work, because you need to do a checkout first before you can import each version. (My working copy is normally a checkout of <tt>/trunk</tt>, not of <tt>/vendor/mediawiki</tt>.) Luckily, Subversion is distributed with a handy Perl script, <tt>svn_load_dirs.pl</tt>, which can do most of the heavy lifting.</p>

<p>Still, I didn&#8217;t feel like having to do to many manual steps, such as typing in the painfully long URLs for merging, so I decided to wrap the whole process into a nice little Bash script:</p>

<pre class="bash">cat upgrade-mediawiki.sh
<span style="color: #808080; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #0000ff;">svn_repo_url=</span>file:///var/svn/wiki.omega-research.org/vendor/mediawiki/
&nbsp;
<span style="color: #0000ff;">merge=</span><span style="color: #cc66cc;">1</span>
<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#91;</span> $<span style="color: #808080; font-style: italic;"># -gt 2 ] # Process extra options</span>
<span style="color: #b1b100;">do</span>
    <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #b1b100;">in</span>
        --no-merge<span style="color: #66cc66;">&#41;</span>
            <span style="color: #0000ff;">merge=</span><span style="color: #cc66cc;">0</span>
            ;;
    <span style="color: #b1b100;">esac</span>
    <span style="color: #000066;">shift</span>
<span style="color: #b1b100;">done</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span> $<span style="color: #808080; font-style: italic;"># -ne 2 ]; then</span>
    <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 [--no-merge] version version&quot;</span>
    <span style="color: #000066;">exit</span> <span style="color: #cc66cc;">1</span>
<span style="color: #b1b100;">fi</span>
&nbsp;
<span style="color: #0000ff;">last_version=</span>$<span style="color: #cc66cc;">1</span>
<span style="color: #0000ff;">new_version=</span>$<span style="color: #cc66cc;">2</span>
&nbsp;
<span style="color: #0000ff;">tmp_dir=</span>`mktemp -d`
<span style="color: #000066;">cd</span> <span style="color: #0000ff;">$tmp_dir</span>
&nbsp;
<span style="color: #b1b100;">for</span> version <span style="color: #b1b100;">in</span> $*; <span style="color: #b1b100;">do</span>
    <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;Downloading and extracting MediaWiki version $version...&quot;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span> -z `svn ls <span style="color: #0000ff;">$svn_repo_url</span>|grep <span style="color: #0000ff;">$version</span>` <span style="color: #66cc66;">&#93;</span>; <span style="color: #b1b100;">then</span>
        <span style="color: #0000ff;">branch=</span>`<span style="color: #000066;">echo</span> <span style="color: #0000ff;">$version</span> |sed -e <span style="color: #ff0000;">'s/<span style="color: #000099; font-weight: bold;">\.</span>[0-9]<span style="color: #000099; font-weight: bold;">\+</span>$//'</span>`
        <span style="color: #0000ff;">download_file=</span><span style="color: #ff0000;">&quot;mediawiki-$version.tar.gz&quot;</span>
        <span style="color: #0000ff;">download_url=</span><span style="color: #ff0000;">&quot;http://download.wikimedia.org/mediawiki/$branch/$download_file&quot;</span>
&nbsp;
        wget <span style="color: #0000ff;">$download_url</span> || <span style="color: #66cc66;">&#123;</span> <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;Downloading $download_file failed&quot;</span>&gt;&amp;<span style="color: #cc66cc;">2</span>; <span style="color: #000066;">exit</span> <span style="color: #cc66cc;">1</span>; <span style="color: #66cc66;">&#125;</span>
        tar --extract --ungzip --transform <span style="color: #ff0000;">'s/^mediawiki-//'</span> --file <span style="color: #0000ff;">$download_file</span>
        svn_load_dirs.pl <span style="color: #0000ff;">$svn_repo_url</span> -t <span style="color: #0000ff;">$version</span> current <span style="color: #0000ff;">$version</span>
    <span style="color: #b1b100;">fi</span>
<span style="color: #b1b100;">done</span>
&nbsp;
<span style="color: #000066;">cd</span> -
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span> <span style="color: #0000ff;">$merge</span> == <span style="color: #ff0000;">'1'</span> <span style="color: #66cc66;">&#93;</span>; <span style="color: #b1b100;">then</span>
    svn merge <span style="color: #ff0000;">&quot;$svn_repo_url$last_version&quot;</span> <span style="color: #ff0000;">&quot;$svn_repo_url$new_version&quot;</span> .
<span style="color: #b1b100;">fi</span>
&nbsp;
<span style="color: #000066;">exit</span> <span style="color: #cc66cc;">0</span></pre>

<p>The script only downloads and imports each specified version if that version doesn&#8217;t already exist in <tt>/vendor/mediawiki/</tt>. Also, because it has a <tt>--no-merge</tt> option, you can download all the old versions of MediaWiki that you&#8217;ve ever used, so that you can go back and compare old versions of your installation with the factory version. Of course, this is only useful if you were already tracking your installation in svn at the time, and even then not really. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>Anyway, the important thing is that you can use the script to download the version you&#8217;re running now and the version you want to upgrade too. I wanted to make a big jump, from 1.11.1 to 1.15.0 (I had put of the upgrade for a long time, because I first wanted to learn more about vendor branches):</p>

<p>Of course, as always, you need to check if the patch went well. My own results were a vivid demonstration of the unreliability of my previous method:</p>

<pre class="bash">svn st|grep <span style="color: #ff0000;">'^C'</span></pre>

<pre>
C      languages/messages/MessagesKrj.php
C      languages/messages/MessagesWar.php
C      languages/messages/MessagesSe.php
C      languages/messages/MessagesFrc.php
</pre>

<p>Luckily, these were all files I was sure I hadn&#8217;t modified:</p>

<pre class="bash"><span style="color: #b1b100;">for</span> i <span style="color: #b1b100;">in</span> `svn st|grep <span style="color: #ff0000;">'^C'</span>|sed -e <span style="color: #ff0000;">'s/^C //'</span>`; <span style="color: #b1b100;">do</span> mv <span style="color: #0000ff;">$i</span>.merge-right.r32 <span style="color: #0000ff;">$i</span>; svn resolved <span style="color: #0000ff;">$i</span>; <span style="color: #b1b100;">done</span></pre>

<pre>
Resolved conflicted state of 'languages/messages/MessagesKrj.php'
Resolved conflicted state of 'languages/messages/MessagesWar.php'
Resolved conflicted state of 'languages/messages/MessagesSe.php'
Resolved conflicted state of 'languages/messages/MessagesFrc.php'
</pre>

<p>Apparently, a previous upgrade hadn&#8217;t turned my MediaWiki installation <em>exactly</em> into 1.11.1.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2009/07/20/svn-vendor-branches/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Editing Wikipedia/MediaWiki articles with VIM</title>
		<link>http://blog.bigsmoke.us/2009/07/10/vim-mediawiki-editing</link>
		<comments>http://blog.bigsmoke.us/2009/07/10/vim-mediawiki-editing#comments</comments>
		<pubDate>Fri, 10 Jul 2009 08:34:42 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[VIM]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=515</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Wikipedia has <a href="http://en.wikipedia.org/wiki/Wikipedia:Text_editor_support#Vim">a number of tips</a> for people who like to edit Wikipedia articles with VIM.</p> 

<p>Of course, it all starts with opening an article in VIM. How I do this depends on my mood: I can open it by firing GVIM using Vimperator or I can <a href="http://blog.bigsmoke.us/2009/03/27/wikipedia-mediawiki-fuse-fs">mount the wiki with WikipediaFS</a>. I prefer the latter.</p>

<h2>Spell-checking</h2>

<p>One tool that&#8217;s very convenient for editing large sections of prose is VIM&#8217;s built-in <a href="http://vimdoc.sourceforge.net/htmldoc/spell.html">spell-checker</a>. Example:</p>

<pre>
set textwidth=0
set spell spelllang=nl
</pre>

<h2>Wrapping, matching and folding</h2>

<p>There&#8217;s some more useful stuff that I copied to &#8220;<tt>ftplugin/mediawiki.vim</tt>&#8221; in &#8220;<tt>$HOME/.vim/</tt>&#8220;:</p>

<pre>
" Wikipedia articles often only have line-breaks at the end of each paragraph,
" a situation Vim by default doesn't handle as other text editors.
setlocal wrap linebreak
setlocal textwidth=0

" No auto-wrap at all
setlocal formatoptions-=tc formatoptions+=l
if v:version >= 602 | setlocal formatoptions-=a | endif

" Make navigation more amenable to the long wrapping lines.
noremap <buffer> k gk
noremap <buffer> j gj
noremap <buffer> <Up> gk
noremap <buffer> <Down> gj
noremap <buffer> 0 g0
noremap <buffer> ^ g^
noremap <buffer> $ g$
noremap D dg$
noremap C cg$
noremap A g$a
inoremap <buffer> <Up> <C-O>gk
inoremap <buffer> <Down> <C-O>gj

" utf-8 should be set if not already done globally
setlocal fileencoding=utf-8
setlocal matchpairs+=<:>

" Treat lists, indented text and tables as comment lines and continue with the
" same formatting in the next line (i.e. insert the comment leader) when hitting
" <CR> or using "o".
setlocal comments=n:#,n:*,n:\:,s:{\|,m:\|,ex:\|}
setlocal formatoptions+=roq

" match HTML tags (taken directly from $VIM/ftplugin/html.vim)
if exists("loaded_matchit")
    let b:match_ignorecase=0
    let b:match_skip = 's:Comment'
    let b:match_words = '<:>,' .
    \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
    \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
    \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
endif

" Other useful mappings
" Insert a matching = automatically while starting a new header.
inoremap <buffer> <silent> = <C-R>=(getline('.')==''\|\|getline('.')=~'^=\+$')?"==\<Lt>Left>":"="<CR>

" Enable folding based on ==sections==
:set foldexpr=getline(v:lnum)=~'^\\(=\\+\\)[^=]\\+\\1\\(\\s*<!--.*-->\\)\\=\\s*$'?\">\".(len(matchstr(getline(v:lnum),'^=\\+'))-1):\"=\"
:set fdm=expr
</pre>

<p>To have this automatically executed when opening files ending in <tt>.mw</tt>:</p>

<pre class="bash"><span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;autocmd BufRead,BufNewFile *.mw setfiletype mediawiki&quot;</span> &gt; <span style="color: #0000ff;">$HOME</span>/.vim/ftdetect/mediawiki.vim</pre>

<h2>Syntax highlighting</h2>

<p>Additionally, if you want to have syntax highlighting for MediaWiki articles, you can save <a href="http://en.wikipedia.org/w/index.php?title=User:Samsara/Wikipedia.vim&#038;action=raw&#038;ctype=text/plain">this syntax file</a> to <tt>$HOME/.vim/syntax/mediawiki.vim</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2009/07/10/vim-mediawiki-editing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing a MediaWiki Gravatars template</title>
		<link>http://blog.bigsmoke.us/2009/04/15/mediawiki-gravatar-template</link>
		<comments>http://blog.bigsmoke.us/2009/04/15/mediawiki-gravatar-template#comments</comments>
		<pubDate>Wed, 15 Apr 2009 19:06:18 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Gravatar]]></category>
		<category><![CDATA[MediaWiki]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=226</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>This is a tutorial for <a href="http://www.mediawiki.org/">MediaWiki</a> users who want to learn how to create and use templates.</p>

<p>One day, I was looking for a MediaWiki extension to include a <a href="http://en.gravatar.com/">Gravatar</a> (globally recognized avatar) in my <a href="http://wiki.hardwood-investments.net/User:BigSmoke">user page</a> on one of my MediaWiki installations. I did find <a href="http://www.mediawiki.org/wiki/Extension:Gravatar">an extension</a>, but I thought it to be no better than writing a template myself.</p>

<h2>A MediaWiki template</h2>

<p>In a MediaWiki installation, if you find yourself repeating yourself in a lot of pages, you can turn the repetitive content into a template. This template can then be included in any page where you&#8217;d otherwise duplicate the content. In fact, you can include any page, but most templates will live in a separate namespace: <q><tt>Template</tt></q>.</p>

<p>To include a template, put the template name inside double curly braces, like this: <q><tt>{{My template}}</tt></q>. For templates inside the <tt>Template</tt> namespace (most templates), you can omit the namespace part. This means that if your template page name is <q>Template:My template</q>, you will call your template as in the previous example (<q><tt>{{My template}}</tt></q>).

<h2>Template parameters</h2>

<p>Parameterization is a fancy word for what programmers do when they don&#8217;t want a function to return the same value on each invocation. They add parameters to the function. MediaWiki templates support parameters.</p>

<p>If you have a template called <tt>Template:My template</tt> which contains &#8220;<tt>I say this very often, but not {{{1}}}.</tt>&#8220;, you can invoke it with &#8220;<tt>{{My template|quite often enough}}</tt>&#8220;, you&#8217;ll get the text &#8220;<tt>I say this very often but not quite often enough</tt>&#8220;.</p>

<p>Template parameters are preceded by a pipe symbol (&#8220;|&#8221;). If you add more parameters, each in turn has to be preceded by the same symbol. Whitespace (even newlines) may be used before or after the pipe to increase readability.</p>

<p>To indicate where in the template you want the parameter value to appear, <strong>triple</strong> curly braces are used with the number of the parameter inside.</p>

<h3>Named parameters</h2>

<p>When your template accepts a lot of parameters, you might find it convenient to name the parameters instead of numbering them. Named and numbered parameters can be mixed (but the numbered parameters must come first):</p>

<pre>{{Fruit|apple|color=red}}</pre>

<p>Referencing the named parameter in the template is as easy as referencing a numbered parameter:</p>

<pre>When I need vitamins, I can eat an {{{1}}}. This fruit is {{{color}}}.</pre>

<h3>Default parameter values</h3>

<p>Parameters can be made optional, by adding a default value:</p>

<pre>When I need vitamins, I can eat an {{{1|orange}}}. This fruit is {{{color|orange}}}.</pre>

<p>Now, you can call the <tt>Fruit</tt> template with no arguments if you just want an orange.</p>

<h2>Gravatar API</h2>

<p>Gravatars are retreived by using a very simple <a href="http://en.gravatar.com/site/implement/url">URL API</a>. The URL is constructed using the MD5-sum of your email address:</p>

<pre class="bash"><span style="color: #000066;">echo</span> -n <span style="color: #0000ff;">$EMAIL</span>|md5sum
77eca8beb1df91ca21e6c781e62630f8</pre>

<p><tt><a href="http://www.gravatar.com/avatar/77eca8beb1df91ca21e6c781e62630f8">http://www.gravatar.com/avatar/77eca8beb1df91ca21e6c781e62630f8</a></tt></p>

<p>Optional parameters can be given in the URL. For now, I&#8217;m only interested in <tt>s</tt> (for size). This defaults to 80 pixels, but I want a bigger image:</p>

<p><tt><a href="http://www.gravatar.com/avatar/77eca8beb1df91ca21e6c781e62630f8?s=200">http://www.gravatar.com/avatar/77eca8beb1df91ca21e6c781e62630f8?s=200</a></tt></p>

<h2>A working Gravatar template</h2>

<p>On my Hardwood Investments Wiki, I have made a <a href="http://wiki.hardwood-investments.net/index.php?title=Template:User_Gravatar&#038;oldid=436">template</a> that is meant to be used on a user page (such as <a href="http://wiki.hardwood-investments.net/User:BigSmoke">my own</a>) to display a Gravatar similarly to how captioned images are normally formatted:</p>

<pre>
&lt;noinclude&gt;
This template shows a Gravatar for the given e-mail address belonging to a given MD5 sum.

== Example ==

&lt;pre&gt;
{{User Gravatar|41165a7e7126d616a0ae0762e00718e2}}
&lt;/pre&gt;

&lt;/noinclude&gt;&lt;includeonly&gt;&lt;div style="margin: 0 0 1em 1em; float: right; border: 1px solid #ccc; background-color: #f9f9f9; padding: 3px;"&gt;
&lt;div style="border: 1px solid #ccc;"&gt;

http://www.gravatar.com/avatar/{{{1}}}?s=200.jpg

&lt;/div&gt;{{PAGENAME}}
&lt;/div&gt;&lt;/includeonly&gt;
</pre>

<p>This template introduces a two new concepts: the <tt>&lt;noinclude&gt;</tt> section is only used when viewing the template page and the <tt>&lt;includeonly&gt;</tt> section is used only when viewing the page that includes the template; <tt>{{PAGENAME}}</tt> is a <em>magic word</em> that is used to display the username as the image caption.</p>

<p>Now that I&#8217;ve demonstrated a practical application of MediaWiki templates, I can finally publish this draft. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2009/04/15/mediawiki-gravatar-template/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mounting a MediaWiki installation with WikipediaFS for FUSE</title>
		<link>http://blog.bigsmoke.us/2009/03/27/wikipedia-mediawiki-fuse-fs</link>
		<comments>http://blog.bigsmoke.us/2009/03/27/wikipedia-mediawiki-fuse-fs#comments</comments>
		<pubDate>Fri, 27 Mar 2009 12:40:07 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[FUSE]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[Wikipedia]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=444</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Another one of those I-wish-I-had-blogged-about-this moments: I wanted to bulk-edit some pages in my <a href="http://wiki.hardhout-investeringen.net/Hoofdpagina">Dutch Hardwood Wiki</a> and I knew I had previously done some scripting using a FUSE filesystem for MediaWiki. However, I didn&#8217;t remember the name of the filesystem I had used before. Searching for &#8220;mediawiki fuse&#8221; didn&#8217;t help in any way.</p>

<p>I found <a href="http://wikipediafs.sourceforge.net/">the link</a> again <a href="http://en.wikipedia.org/wiki/Wikipedia:Syntax_highlighting#Wikipediafs">in</a> the Wikipedia meta-space. Now that I know that it&#8217;s called WikipediaFS and not something like MediaWikiFS, I remember that this was the exact same problem as the last time when I was looking for this. But, alas, I&#8217;ve blogged about it now, so now I can safely forget the name again. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2009/03/27/wikipedia-mediawiki-fuse-fs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MediaWiki problems with MySQL VARBINARY padding</title>
		<link>http://blog.bigsmoke.us/2009/03/09/mediawiki-mysql-varbinary-padding</link>
		<comments>http://blog.bigsmoke.us/2009/03/09/mediawiki-mysql-varbinary-padding#comments</comments>
		<pubDate>Mon, 09 Mar 2009 12:00:51 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[InnoDB]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=403</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>I have been wanting to protect a <a href="http://15monkeys.com/wiki/nl/Overleg:Hoofdpagina">certain page</a> on my Dutch 15Monkeys wiki for weeks. I could install the ReCaptcha extension already (the best Captcha there is), but it&#8217;s just that one page that&#8217;s being spammed. So far, I&#8217;ve been <a href="http://blog.bigsmoke.us/2009/02/04/mediawiki-userrights">unsuccessful</a> in regaining my Sysop right for that wiki. I need these rights if I&#8217;m going to protect these pages.</p>

<p>In the <a href="http://blog.bigsmoke.us/2009/02/04/mediawiki-userrights">previous post</a> about this problem, I reported how there appeared to be padding problem caused by a MySQL upgrade. Fixing the padding didn&#8217;t solve the problem, however. If I look at the user list in MediaWiki, I notice that MediaWiki doesn&#8217;t seem to like it that MySQL returns all the <tt>\0x0</tt> padding characters on <tt>SELECT</tt>:</p>

<div id="attachment_404" class="wp-caption alignright" style="width: 310px"><a title="15Monkeys MediaWiki NL user list with unrecognized characters" href="http://blog.bigsmoke.us/uploads/2009/02/15monkeys-mediawiki-gebruikerslijst-raar.jpeg" rel="lightbox[mw]"><img src="http://blog.bigsmoke.us/uploads/2009/02/15monkeys-mediawiki-gebruikerslijst-raar-300x195.jpg" alt="15Monkeys MediaWiki NL user list with unrecognized characters" title="15Monkeys MediaWiki gebruikerslijst (met onbekende karakters)" width="300" height="195" class="size-medium wp-image-404" /></a><p class="wp-caption-text">15Monkeys MediaWiki NL user list with unrecognized characters</p></div>

<div id="attachment_405" class="wp-caption alignright" style="width: 310px"><a title="The same problem in the EN wiki" href="http://blog.bigsmoke.us/uploads/2009/02/15monkeys-mediawiki-user-list-strange.jpeg" rel="lightbox[mw]"><img src="http://blog.bigsmoke.us/wp-factory/../uploads/2009/02/15monkeys-mediawiki-user-list-strange-300x195.jpg" alt="The same problem in the EN wiki" title="15Monkeys MediaWiki user list (with unknown characters)" width="300" height="195" class="size-medium wp-image-405" /></a><p class="wp-caption-text">The same problem in the EN wiki</p></div>

<pre>BigSmoke ‎(bureaucrat������, sysop�����������)</pre>

<p>Repair was suggested by the check operation in phpMyAdmin. (<tt>CHECK TABLE `mw_nl_user_groups`</tt>) I couldn&#8217;t find a repair operation (only <tt>OPTIMIZE</tt>), so I tried that and I was told that it went ok. In the database structure view, the repair option <em>was</em> available ; when I tried to repair <em>all</em> the tables belonging to this installation, I was told for this particular table (and one other) &#8220;The storage engine for the table doesn&#8217;t support repair&#8221;. I found out that the reason this error didn&#8217;t appear the first time because it appears quite randomly. Sometimes it just silently fails in true MySQL style.</p> 

<p><a href="http://www.google.com/search?q=%22the+storage+engine+for+the+table+doesn%27t+support+repair%22">Googling</a> for the error message produced the advice to dump and recreate the table. Then, when recreating the table from my backup didn&#8217;t work, I found out that <tt>REPAIR</tt> <em>really</em> isn&#8217;t supported for InnoDB. Only <tt>CHECK</tt> is. If you want to repair an InnoDB table, you use <tt>OPTIMIZE</tt> or you have to restart mysqld with the <tt>innodb_force_recovery</tt> option enabled.</p>

<p>Then, it turned out that I misinterpreted the MySQL <a href="http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html">documentation for the <tt>VARBINARY</tt> type</a>, although I still can&#8217;t figure out how I am supposed to deduce this from said documentation. Anyway, if I <tt>UPDATE</tt> the rows, all I can achieve is that whitespace is converted to <tt>\0</tt> characters. But, if I reinsert them without the padding, it does work. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_confused.gif' alt=':-?' class='wp-smiley' />  Go figure&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2009/03/09/mediawiki-mysql-varbinary-padding/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Lost my Sysop rights in the 15Monkeys wikis</title>
		<link>http://blog.bigsmoke.us/2009/02/04/mediawiki-userrights</link>
		<comments>http://blog.bigsmoke.us/2009/02/04/mediawiki-userrights#comments</comments>
		<pubDate>Wed, 04 Feb 2009 18:20:15 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=347</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>I am constantly bugged by spammers in my 15 Monkeys wiki farm[<a href="http://15monkeys.com/wiki/en/">1</a>, <a href="http://15monkeys.com/wiki/nl/">2</a>], but I wasn&#8217;t allowed to protect the victim pages anymore. So, I wondered where my Sysop rights had gone.</p>

<p>Turned out they weren&#8217;t gone:</p>

<pre class="sql"><span style="color: #993333; font-weight: bold;">SELECT</span> user_id, user_name, CONCAT<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'&quot;'</span>, ug_group, <span style="color: #ff0000;">'&quot;'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> ug_group_quoted
<span style="color: #993333; font-weight: bold;">FROM</span> mw_nl_user_groups
<span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> mw_nl_user <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #66cc66;">&#40;</span> ug_user = user_id <span style="color: #66cc66;">&#41;</span></pre>

<table>
  <tr><th>user_id</th><th>user_name</th><th>ug_group_quoted</th></tr>
  <tr><td>1</td><td>BigSmoke</td><td><tt>"bureaucrat      "</tt></td></tr>
  <tr><td>1</td><td>BigSmoke</td><td><tt>"sysop           "</tt></td></tr>
</table>

<p>They were just padded a bit. I have had a <a href="http://blog.bigsmoke.us/2008/12/27/images-not-showing-after-upgrade-to-mediawiki-1.13">similar problem</a> with MediaWiki before, so I remembered where to look <em>within</em> the hour this time. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  I tried a quick fix:</p>

<pre class="sql"><span style="color: #993333; font-weight: bold;">UPDATE</span> mw_nl_user_groups <span style="color: #993333; font-weight: bold;">SET</span> ug_group = rtrim<span style="color: #66cc66;">&#40;</span>ug_group<span style="color: #66cc66;">&#41;</span>;</pre>

<p>I was surprised to see in phpMyAdmin that the values where now no longer padded with spaces, but with null-bytes (&#8220;<tt>\0</tt>&#8220;) instead. I tried to fix this untill I found out that this is the normal behaviour in MySQL 5.0.15. The MySQL documentation <a href="http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html">also mentions</a> that, before 5.0.15, <tt>VARBINARY</tt> values were padded with spaces instead. Apparently, my mystery problems with padding were never caused by MediaWiki but by MySQL itself&#8230; PostgreSQL, where are you when I need you?</p>

<p>My advice: don&#8217;t run your own database-backed CMS if you don&#8217;t have at least rudimentary DBA skills.</p>

<p>The suckiness is: this time, the problem isn&#8217;t solved by just converting the padding. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />  I&#8217;ll have to look into it some further.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2009/02/04/mediawiki-userrights/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

