<?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>PCR&#039;s notepad &#187; MediaWiki</title>
	<atom:link href="http://notepad.patheticcockroach.com/category/software/mediawiki/feed/" rel="self" type="application/rss+xml" />
	<link>http://notepad.patheticcockroach.com</link>
	<description>The area in patheticcockroach.com where the EEG isn&#039;t isoelectric</description>
	<lastBuildDate>Fri, 30 Jul 2010 11:13:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MediaWiki automated upgrade script</title>
		<link>http://notepad.patheticcockroach.com/715/mediawiki-automated-upgrade-script/</link>
		<comments>http://notepad.patheticcockroach.com/715/mediawiki-automated-upgrade-script/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 06:19:52 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=715</guid>
		<description><![CDATA[Last week-end, I finally took the time to upgrade Wiki4Games to MediaWiki 1.15.4. We&#8217;d been running it on 1.15.2 since, hm, a long time ago and never moved to 1.15.3 because the security issues fixed weren&#8217;t too big and wouldn&#8217;t affect members using things like the NoScript Firefox extension. 1.15.4 added extra fixes in the [...]]]></description>
			<content:encoded><![CDATA[<p>Last week-end, I finally took the time to upgrade <a href="http://www.wiki4games.com">Wiki4Games</a> to MediaWiki 1.15.4. We&#8217;d been running it on 1.15.2 since, hm, a long time ago and never moved to 1.15.3 because the security issues fixed weren&#8217;t too big and wouldn&#8217;t affect members using things like the <a href="https://addons.mozilla.org/en-US/firefox/addon/722/">NoScript</a> Firefox extension. 1.15.4 added extra fixes in the same field, but since the potential troubles included the possibility to change an imprudent user&#8217;s password, I thought it was time to do the update. Usually for minor updates I use the .patch file, but since 1. the patch file was a bit bigger than usual ; 2. I would need to apply two patches (1.15.3 then 1.15.4) ; and 3. MediaWiki 1.16 is on its way and should arrive &#8220;soon&#8221;, I thought it would be a good idea to finally (Wiki4Games was created more than 2 years ago, under MediaWiki 1.12.x) make an upgrade script. And here it is:</p>
<p><code>cd /home/wiki4games<br />
wget http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.4.tar.gz<br />
tar xf mediawiki-1.15.4.tar.gz<br />
mv wwwOLD wwwOLD2<br />
mv mediawiki-1.15.4 wwwNEW</p>
<p>echo "Cleaning up wwwNEW (removing extensions and images folders)"<br />
rm wwwNEW/images/README<br />
rm wwwNEW/images<br />
rm wwwNEW/extensions/README<br />
rm wwwNEW/extensions<br />
mv www/.htaccess www/.temphtaccess<br />
cp sd/down/.downhtaccess www/.htaccess</p>
<p>mv www/00files wwwNEW<br />
mv www/0custom wwwNEW<br />
mv www/extensions wwwNEW<br />
mv www/images wwwNEW<br />
mv www/skins/0custom wwwNEW/skins<br />
cp www/404.php wwwNEW<br />
cp www/AdminSettings.php wwwNEW<br />
cp www/LocalSettings.php wwwNEW<br />
cp www/.temphtaccess wwwNEW<br />
mv www wwwOLD<br />
mv wwwNEW www<br />
cd www/maintenance<br />
php update.php<br />
cd ../..<br />
rm www/.htaccess<br />
mv www/.temphtaccess www/.htaccess</p>
<p>echo "All done. You can also delete wwwOLD2, www/config and www/docs"</code></p>
<p><strong>Of course, to apply it to your own MediaWiki installation, you&#8217;ll need to do some customization</strong>. Let&#8217;s give some explanations:</p>
<p><code>cd /home/wiki4games</code><br />
We move to the directory just higher than where MediaWiki is installed.</p>
<p><code>wget http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.4.tar.gz<br />
tar xf mediawiki-1.15.4.tar.gz</code><br />
We download and uncompress MediaWiki 1.15.4.</p>
<p><code>mv wwwOLD wwwOLD2</code><br />
wwwOLD is a folder where I keep the previous version, so we move it to wwwOLD2 to free the wwwOLD name (that&#8217;s where we&#8217;ll move the current installation). wwwOLD2 can be deleted manually at the end of the process. I chose not to place any kind of <code>rm -r</code> command in this script, which is why I don&#8217;t delete wwwOLD but rename it instead.</p>
<p><code>mv mediawiki-1.15.4 wwwNEW</code><br />
We move MediaWiki to a folder with a more friendly name.</p>
<p><code>echo "Cleaning up wwwNEW (removing extensions and images folders)"<br />
rm wwwNEW/images/README<br />
rm wwwNEW/images<br />
rm wwwNEW/extensions/README<br />
rm wwwNEW/extensions</code><br />
We remove the <em>extensions</em> and <em>images</em> folders from the standard installation, so that we can later move our own extensions and images folder in their place)</p>
<p><code>mv www/.htaccess www/.temphtaccess<br />
cp sd/down/.downhtaccess www/.htaccess</code><br />
Here I replace the production .htaccess file with a maintenance one. Our maintenance .htaccess file redirects all trafic to down.wiki4games.com/maintenance.htm, but you can use one which just denies all access (order allow, deny; deny from all). The important thing here is that noone loads the wiki during the sensitive moves (this will result in a very short down time, hardly noone will notice it, it&#8217;s just the time needed to move some folders around&#8230; plus to apply the database patches, which might be a bit longer from a major version to another).</p>
<p><code>mv www/00files wwwNEW<br />
mv www/0custom wwwNEW<br />
mv www/extensions wwwNEW<br />
mv www/images wwwNEW<br />
mv www/skins/0custom wwwNEW/skins<br />
cp www/404.php wwwNEW<br />
cp www/AdminSettings.php wwwNEW<br />
cp www/LocalSettings.php wwwNEW<br />
cp www/.temphtaccess wwwNEW</code><br />
We move the big things and copy the small individual files.</p>
<p><code>mv www wwwOLD<br />
mv wwwNEW www</code><br />
The current MediaWiki becomes OLD, the NEW one becomes current.</p>
<p><code>cd www/maintenance<br />
php update.php</code><br />
We run the maintenance database update script. On a large wiki, this may take a while (unless there is no database scheme change).</p>
<p><code>cd ../..<br />
rm www/.htaccess<br />
mv www/.temphtaccess www/.htaccess</code><br />
And we restore the original .htaccess, the new wiki is opened <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  If you got no error message during the script, it&#8217;s probably up and working. If you did get error messages, you can still check if it works but you&#8217;ll probably need to do some fixing.</p>
<p><code>echo "All done. You can also delete wwwOLD2, www/config and www/docs"</code><br />
Those are useless folders, but I didn&#8217;t place a removal command for them in the script because I didn&#8217;t want to use rm -r.</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/715/mediawiki-automated-upgrade-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Very pretty URLs in MediaWiki</title>
		<link>http://notepad.patheticcockroach.com/514/very-pretty-urls-in-mediawiki/</link>
		<comments>http://notepad.patheticcockroach.com/514/very-pretty-urls-in-mediawiki/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 10:43:56 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=514</guid>
		<description><![CDATA[Finally, we did it, we put short URLs (aka pretty URLs) on Wiki4Games. The thing is, I had a hard time at this because I did it a way which seems to be definitely inadvisable according to MediaWiki&#8217;s short URL how-to. Basically the recommended method says that you need to place your MediaWiki files anywhere [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, we did it, we put short URLs (aka pretty URLs) on <a href="http://www.wiki4games.com">Wiki4Games</a>. The thing is, I had a hard time at this because I did it a way which seems to be definitely inadvisable according to MediaWiki&#8217;s <a href="http://www.mediawiki.org/wiki/Manual:Short_URL#Recommended_how-to_guide_.28setup_used_on_Wikipedia.29">short URL how-to</a>. Basically the recommended method says that you need to place your MediaWiki files anywhere but in the root folder (e.g., wiki4games.com/w/) and that you also need to make your wiki run in a different, non-existing and not root virtual directory (e.g. wiki4games.com/wiki/). Not only this method will result in <a href="http://www.mediawiki.org/wiki/Manual:Wiki_in_site_root_directory#Questions">silly looking URLs</a> but it also needs you to edit httpd.conf.</p>
<h2>Potential issues</h2>
<p>Anyway, I decided to try and find my own way to the much not recommended wiki4games.com/Page_Title URL scheme. Before going further, the potential problems with this are:</p>
<ol>
<li>It&#8217;s unsupported, so if it ever gets broken by a MediaWiki update you won&#8217;t get help from them to fix it.</li>
<li>Your wiki won&#8217;t be able to have a page named like one of the core files. This shouldn&#8217;t create many problems, yet you should be aware of this before going further. The potential issues with this limitation are also reduced by the fact that any MediaWiki page name begins with a capitalized letter, while no core file does. So on a case-sensitive server (Linux&#8230; <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) you can&#8217;t create a MediaWiki page named <em>index.php</em> but you can still create one named <em>Index.php</em>!</li>
</ol>
<h2>The .htaccess part</h2>
<p>First I leeched WordPress&#8217;s .htaccess file: my new .htaccess file is now:<br />
<code>&lt;IfModule mod_rewrite.c&gt;<br />
RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule . /index.php [PT,L,QSA]<br />
&lt;/IfModule&gt;<br />
#ErrorDocument 404 /404.php</code><br />
In case you really don&#8217;t have a clue, this .htaccess file should be saved in the webserver&#8217;s root folder, which in our case is the wiki&#8217;s root folder. This file is explained in details <a href="http://rogerkar.blogspot.com/2009/04/wordpress-htaccess-file-explained.html">there</a>. Basically, it says that if the URL requested doesn&#8217;t point to a file (-f) or a directory (-d), Apache will load index.php.<br />
The error document is our former pretty URL handler (we made it to redirect all 404s to index.php, so in a way pretty URLs existed but MediaWiki didn&#8217;t use it because it wasn&#8217;t configured for it), if the improved solution ever breaks we could still quickly fall back to this old 404. Here it is if you want it: <a href="http://www.wiki4games.com/User:Patheticcockroach/404.php">http://www.wiki4games.com/User:Patheticcockroach/404.php</a>.</p>
<p>It&#8217;s been reported that RewriteRule may encounter problems with special characters like ampersand, the fix for it would be to <a href="http://www.mediawiki.org/wiki/Manual:Short_URL/Ampersand_solution#Simple_solution_for_Apache_2.2.2B">add a B flag to the rewrite rule</a>. I.e.:<br />
<code>RewriteRule . /index.php [PT,L,QSA,B]</code><br />
(NB: this would work too: <code>RewriteRule . /index.php?title=$1 [PT,L,QSA,B]</code>).<br />
It&#8217;s also been reported that for some unspecified reason you need to add <a href="http://www.mediawiki.org/wiki/Manual_talk:Short_URL#.htaccess_file_for_Apache_that_always_works">Options FollowSymLinks</a> in the .htaccess file. I didn&#8217;t need to, but if you experience trouble you might as well try to add this line.</p>
<h2>Now LocalSettings.php</h2>
<p>Then I tweaked some LocalSettings.php lines:<br />
1. I already had (and you should have this too if you&#8217;re on a wiki ran from the root directory of your web server), from the existing installation:<br />
<code><a href="http://www.mediawiki.org/wiki/Manual:$wgScriptPath">$wgScriptPath</a>       = "";<br />
<a href="http://www.mediawiki.org/wiki/Manual:$wgScriptExtension">$wgScriptExtension</a>  = ".php";</code><br />
These lines are fine, just let them this way.<br />
2. The 2 settings I had to change were:<br />
<code><a href="http://www.mediawiki.org/wiki/Manual:$wgUsePathInfo">$wgUsePathInfo</a> = true;<br />
<a href="http://www.mediawiki.org/wiki/Manual:$wgArticlePath">$wgArticlePath</a> = "/$1";</code></p>
<h2>Final thoughts</h2>
<p>Well, that pretty much covers it. Upload the modified files and now your pages should work both as yourdomain.com/A_Page and yourdomain.com/index.php?title=A_Page. Like</p>
<ul>
<li><a href="http://www.wiki4games.com/Beneath_a_Steel_Sky">http://www.wiki4games.com/Beneath_a_Steel_Sky</a> and:</li>
<li><a href="http://www.wiki4games.com/index.php?title=Beneath_a_Steel_Sky">http://www.wiki4games.com/index.php?title=Beneath_a_Steel_Sky</a> and even:</li>
<li><a href="http://www.wiki4games.com/Beneath a Steel Sky">http://www.wiki4games.com/Beneath a Steel Sky</a> and finally even:</li>
<li><a href="http://www.wiki4games.com/index.php/Beneath_a_Steel_Sky">http://www.wiki4games.com/index.php/Beneath_a_Steel_Sky</a>!</li>
</ul>
<p>Enjoy your very pretty URLs! <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (which are more than pretty because they don&#8217;t contain a /wiki!)</p>
<p>PS: don&#8217;t forget to check that all your customizations still work, notably your logo on funky pages like subpages: the slash will break the relative path if you didn&#8217;t configure your logo properly, i.e. something like <code>"{$wgScriptPath}/path/to/the/logo.png"</code> or	<code>"{<a href="http://www.mediawiki.org/wiki/Manual:$wgStylePath">$wgStylePath</a>}/common/images/logo.png"</code></p>
<div style="text-align:right;">Software used:<br />
MediaWiki 1.15.1<br />
PHP 5.2.x<br />
Apache 2.2.x</div>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/514/very-pretty-urls-in-mediawiki/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing the &#8220;Invalid title in result set&#8221; error in MediaWiki</title>
		<link>http://notepad.patheticcockroach.com/362/fixing-the-invalid-title-in-result-set-error-in-mediawiki/</link>
		<comments>http://notepad.patheticcockroach.com/362/fixing-the-invalid-title-in-result-set-error-in-mediawiki/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 16:48:54 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=362</guid>
		<description><![CDATA[MediaWiki 1.14 introduced a bug (source) with anchor links: using links like [[#this link]] may create invalid rows in the pagelinks table (empty/NULL pl_title value), resulting in a &#8220;Invalid title in result set&#8221; result at the top of the wanted pages list (Special:WantedPages). This issue is fixed in MediaWiki 1.15 but the invalid rows aren&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>MediaWiki 1.14 introduced a <a href="https://bugzilla.wikimedia.org/show_bug.cgi?id=17713">bug</a> (<a href="http://www.nabble.com/Special:WantedPages:Invalid-title-in-result-set-td22258950.html">source</a>) with anchor links: using links like <code>[[#this link]]</code> may create invalid rows in the <em>pagelinks</em> table (empty/NULL <em>pl_title</em> value), resulting in a &#8220;Invalid title in result set&#8221; result at the top of the wanted pages list (Special:WantedPages).<br />
This issue is fixed in MediaWiki 1.15 <strong>but</strong> the invalid rows aren&#8217;t deleted when running the update script (<a href="https://bugzilla.wikimedia.org/show_bug.cgi?id=17751">bug 17751</a>).</p>
<p>This can be solved by running the <em>refreshLinks.php</em> maintenance script (<em>maintenance/refreshLinks.php</em>). Be careful though, this script is pretty CPU intensive. On our wiki with around 2700 pages, it took around 3 minutes (which is fairly longer than the time needed by the update script).</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/362/fixing-the-invalid-title-in-result-set-error-in-mediawiki/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating a sitemap with MediaWiki&#8230; and how to submit it to Google</title>
		<link>http://notepad.patheticcockroach.com/352/creating-a-sitemap-with-mediawiki-and-how-to-submit-it-to-google/</link>
		<comments>http://notepad.patheticcockroach.com/352/creating-a-sitemap-with-mediawiki-and-how-to-submit-it-to-google/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 15:00:25 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=352</guid>
		<description><![CDATA[Creating the map MediaWiki does have a function to generate its own sitemap. The script is located in the maintenance folder and is called generateSitemap.php. It have to be run from the console (thus you need the php-cli package). In order to have a regularly updated map, we chose to configure its generation to run [...]]]></description>
			<content:encoded><![CDATA[<h2>Creating the map</h2>
<p>MediaWiki does have a function to generate its own sitemap. The script is located in the maintenance folder and is called generateSitemap.php. It have to be run from the console (thus you need the php-cli package). In order to have a regularly updated map, we chose to configure its generation to run as a daily Cron job. The command is quite straightforward:</p>
<blockquote><p><code>php /home/username/www/maintenance/generateSitemap.php --fspath="/home/username/www" --server="http://www.wiki4games.com" --compress=no</code></p></blockquote>
<p>NB: as for some or most of the maintenance scripts, this script requires <em>AdminSettings.php</em> (in the wiki&#8217;s root folder) to be filled properly. This file basically contains the login and password for a database user, and can be created based on <em>AdminSettings.sample</em>.</p>
<ul>
<li>/home/username/www/maintenance/generateSitemap.php is obviously the absolute path to generateSitemap.php</li>
<li>&#8211;fspath=&#8221;/home/username/www&#8221; is the path to the folder where you want to save the sitemaps. The script will generate quite a few files, at <strong>it will create one sitemap per namespace</strong>. Yet, if you want to submit it to Google, you must not place the sitemaps in a subfolder of the wiki (see farther)</li>
<li>&#8211;server=&#8221;http://www.wiki4games.com&#8221; is optional (use it if auto detection fails&#8230; or systematically if you prefer)</li>
<li>&#8211;compress=no disable sitemap compression. I don&#8217;t know if Google is able to read compressed sitemaps, so I disabled it (default is yes)</li>
</ul>
<h2>Submitting the map</h2>
<p>To submit the sitemap to Google, go verify your site to <a href="https://www.google.com/webmasters/tools">Google Webmaster Tools</a> (if you have soft 404 errors you&#8217;ll need to choose the meta tag verification, to add a meta tag just edit your default skin &#8211; eg skins/MonoBook.php -, search for &#8220;&lt;head&gt;&#8221; and add the meta tag somewhere after it) then submit the sitemap index, which is named something like sitemap-index-[database name]-[table prefix].xml. And wait for it to be crawled (should take a few minutes).</p>
<h2>Fixing the errors</h2>
<h3>URL not allowed</h3>
<blockquote><p>URL not allowed<br />
This url is not allowed for a Sitemap at this location.</p></blockquote>
<p>This means that you placed your sitemap either in a level inferior to the pages you are listing (ie in a subfolder), either on another domain (if you&#8217;re listing https://www.mywiki.com, you can&#8217;t place the sitemaps in http://www.mywiki.com nor in https://www.mywiki.com/mymaps). So just move the sitemap to an appropriate place (very same domain and higher or same level as all the URLs listed).</p>
<h3>Invalid URL</h3>
<blockquote><p>Invalid URL<br />
We&#8217;ve detected that a Sitemap you&#8217;ve listed doesn&#8217;t include the full URL.</p></blockquote>
<p>This is just a warning that shouldn&#8217;t prevent indexing. Yet for a nicer icon (valid instead of warning <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) you may want to fix it. This warning is due to the fact that the sitemap index created by the script uses relatives URLs instead of absolute ones. To fix it, you&#8217;ll have to edit the script:</p>
<ul>
<li>open generateSitemap.php</li>
<li>search for <code>function indexEntry</code></li>
<li>in this function, find <code>"\t\t<loc>$filename</loc>\n"</code> and add the path need to make the URL complete. For instance if your sitemap index is on <code>http://www.mywiki.com/sitemap-index-wiki4games-wg_.xml</code>, replace this text with <code>"\t\t<loc>http://www.mywiki.com/$filename</loc>\n"</code> (note the slash!)</li>
</ul>
<p>Regenerate your sitemap, then resubmit it to Google. All should be fine now&#8230; except if one of your maps has over 50k URLs (Google doesn&#8217;t accept this, you need to split them&#8230; and I don&#8217;t know how to do this :/)</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/352/creating-a-sitemap-with-mediawiki-and-how-to-submit-it-to-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Adsense in MediaWiki 1.14.0</title>
		<link>http://notepad.patheticcockroach.com/295/google-adsense-in-mediawiki-1140/</link>
		<comments>http://notepad.patheticcockroach.com/295/google-adsense-in-mediawiki-1140/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 14:27:07 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=295</guid>
		<description><![CDATA[Here is how we set up Google Adsense (and more generally, a customized ad area which will show Google Adsense on pages where it is allowed, and another ad on other pages) to show in MediaWiki 1.14.0: 1. Force the monobook skin for everyone (unless you want to edit every skin…) by putting this setting [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how we set up Google Adsense (and more generally, a customized ad area which will show Google Adsense on pages where it is allowed, and another ad on other pages) to show in MediaWiki 1.14.0:</p>
<p>1. Force the monobook skin for everyone (unless you want to edit every skin…) by putting this setting in LocalSettings.php:<br />
<code>$wgAllowUserSkin = false;</code><br />
NB: this setting is new to MediaWiki 1.14! If you have an older version, either upgrade or see <a href="http://notepad.patheticcockroach.com/209/google-adsense-in-mediawiki-1130/">our previous tutorial</a></p>
<p>2. In your skins folder, create a file within a subfolder (for instance “0custom/ad_vertical.php”) with the following content (edit with your own Google Adsense code as well as your own alternative ad; also, make sure to choose a VERTICAL ad, since we are adding code in the left sidebar!):<br />
<code>&lt;?php<br />
if(!strstr($_SERVER['REQUEST_URI'], "Special:") &#038;&#038;<br />
!strstr($_SERVER['REQUEST_URI'], "action=submit") &#038;&#038;<br />
!strstr($_SERVER['REQUEST_URI'], "action=edit") &#038;&#038;<br />
!strstr($_SERVER['REQUEST_URI'], "Template:"))<br />
echo '&lt;div id="v-g-ads" class="portlet"&gt;<br />
&lt;h5&gt;Google ads&lt;/h5&gt;<br />
&lt;div class="pBody"&gt;<br />
&lt;script type="text/javascript"&gt;&lt;!--<br />
google_ad_client = "pub-9471398824076666";<br />
/* 120x240 for Wiki4Games sidebar */<br />
google_ad_slot = "3512091103";<br />
google_ad_width = 120;<br />
google_ad_height = 240;<br />
//--&gt;<br />
&lt;/script&gt;<br />
&lt;script type="text/javascript"<br />
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;<br />
&lt;/script&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;';<br />
else echo '&lt;div id="v-g-ads" class="portlet"&gt;<br />
&lt;h5&gt;Ads&lt;/h5&gt;<br />
&lt;div class="pBody"&gt;<br />
&lt;a href="http://proxify.com/r/?s=1320"&gt;&lt;img src="http://proxify.com/i/info-110x110.gif" width="110" height="110" alt="disable proxy" border="0"&gt;&lt;/a&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;';<br />
?&gt;</code></p>
<p>3. Edit MonoBook.php as follow:<br />
Replace:<br />
<code>	function languageBox() {<br />
		if( $this-&gt;data['language_urls'] ) {<br />
?&gt;<br />
	&lt;div id="p-lang" class="portlet"&gt;<br />
		&lt;h5&gt;&lt;?php $this-&gt;msg('otherlanguages') ?&gt;&lt;/h5&gt;<br />
		&lt;div class="pBody"&gt;<br />
			&lt;ul&gt;<br />
&lt;?php		foreach($this-&gt;data['language_urls'] as $langlink) { ?&gt;<br />
				&lt;li class="&lt;?php echo htmlspecialchars($langlink['class'])?&gt;"&gt;&lt;?php<br />
				?&gt;&lt;a href="&lt;?php echo htmlspecialchars($langlink['href']) ?&gt;"&gt;&lt;?php echo $langlink['text'] ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php		} ?&gt;<br />
			&lt;/ul&gt;<br />
		&lt;/div&gt;<br />
	&lt;/div&gt;<br />
&lt;?php<br />
		}<br />
	}</code><br />
With:<br />
<code>	function languageBox() {<br />
		if( $this-&gt;data['language_urls'] ) {<br />
?&gt;<br />
	&lt;div id="p-lang" class="portlet"&gt;<br />
		&lt;h5&gt;&lt;?php $this-&gt;msg('otherlanguages') ?&gt;&lt;/h5&gt;<br />
		&lt;div class="pBody"&gt;<br />
			&lt;ul&gt;<br />
&lt;?php		foreach($this-&gt;data['language_urls'] as $langlink) { ?&gt;<br />
				&lt;li class="&lt;?php echo htmlspecialchars($langlink['class'])?&gt;"&gt;&lt;?php<br />
				?&gt;&lt;a href="&lt;?php echo htmlspecialchars($langlink['href']) ?&gt;"&gt;&lt;?php echo $langlink['text'] ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php		} ?&gt;<br />
			&lt;/ul&gt;<br />
		&lt;/div&gt;<br />
	&lt;/div&gt;<br />
&lt;?php<br />
		}<br />
include("0custom/ad_vertical.php");<br />
	}</code><br />
NB: In fact we&#8217;re just adding the include at the end of the function.</p>
<p>4. Upload the stuff (don’t forget there are 2 files to upload, not just one), and you&#8217;re done <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/295/google-adsense-in-mediawiki-1140/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Preventing MediaWiki from revealing your server versions</title>
		<link>http://notepad.patheticcockroach.com/273/preventing-mediawiki-from-revealing-your-server-versions/</link>
		<comments>http://notepad.patheticcockroach.com/273/preventing-mediawiki-from-revealing-your-server-versions/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 13:32:33 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=273</guid>
		<description><![CDATA[MediaWiki features a special page, Special:Version, which displays MediaWiki&#8217;s license, but also a list of the currently installed extensions (with their version), as well as the versions of MediaWiki, PHP and MySQL. For security reasons, you may want to avoid displaying all these versions. As far as I know, no setting can disable the display [...]]]></description>
			<content:encoded><![CDATA[<p>MediaWiki features a special page, <a href="http://www.wiki4games.com/index.php?title=Special:Version">Special:Version</a>, which displays MediaWiki&#8217;s license, but also a list of the currently installed extensions (with their version), as well as the versions of MediaWiki, PHP and MySQL. For security reasons, you may want to avoid displaying all these versions. As far as I know, no setting can disable the display of versions. But you can directly edit MediaWiki&#8217;s source to do so, which is quite straightforward:</p>
<p>1. Open &#8220;includes/specials/SpecialVersion.php&#8221; with a text editor</p>
<p>2. Find the lines:<br />
<code>$this->softwareInformation() .<br />
$this->extensionCredits();</code></p>
<p>3. Comment out the lines you want to hide (the first one is for MediaWiki, PHP and MySQL; the second one for the extensions), for instance if I want to only hide MediaWiki, PHP and MySQL versions, the new code is:<br />
<code>//$this->softwareInformation() .<br />
$this->extensionCredits();</code></p>
<p>4. Upload the new file to your server.</p>
<p>That&#8217;s it. Don&#8217;t forget to reapply this &#8220;patch&#8221; every time you upgrade MediaWiki though!</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/273/preventing-mediawiki-from-revealing-your-server-versions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Analytics in MediaWiki 1.13</title>
		<link>http://notepad.patheticcockroach.com/211/google-analytics-in-mediawiki-113/</link>
		<comments>http://notepad.patheticcockroach.com/211/google-analytics-in-mediawiki-113/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 21:31:00 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=211</guid>
		<description><![CDATA[Here is how we set up Google Adsense to show in MediaWiki 1.13.0 1. Force the monobook skin for everyone (unless you want to edit every skin&#8230;) by putting this setting in LocalSettings.php: $wgSkipSkins = array(&#8220;chick&#8221;, &#8220;cologneblue&#8221;, &#8220;myskin&#8221;, &#8220;nostalgia&#8221;, &#8220;simple&#8221;, &#8220;standard&#8221;, &#8220;modern&#8221;); 2. Edit MonoBook.php: add your tracking code just before: &#60;/body&#62;&#60;/html&#62; 3. Upload the [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how we set up Google Adsense to show in MediaWiki 1.13.0</p>
<p>1. Force the monobook skin for everyone (unless you want to edit every skin&#8230;) by putting this setting in LocalSettings.php:<br />
<blockquote>$wgSkipSkins = array(&#8220;chick&#8221;, &#8220;cologneblue&#8221;, &#8220;myskin&#8221;, &#8220;nostalgia&#8221;, &#8220;simple&#8221;, &#8220;standard&#8221;, &#8220;modern&#8221;);</p></blockquote>
<p>2. Edit MonoBook.php: add your tracking code just before:<br />
<blockquote>&lt;/body&gt;&lt;/html&gt;</p></blockquote>
<p>3. Upload the new version of MonoBook.php and it&#8217;s done</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/211/google-analytics-in-mediawiki-113/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google adsense in MediaWiki 1.13.0</title>
		<link>http://notepad.patheticcockroach.com/209/google-adsense-in-mediawiki-1130/</link>
		<comments>http://notepad.patheticcockroach.com/209/google-adsense-in-mediawiki-1130/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 17:37:00 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=209</guid>
		<description><![CDATA[Here is how we set up Google Adsense to show in MediaWiki 1.13.0 1. Force the monobook skin for everyone (unless you want to edit every skin&#8230;) by putting this setting in LocalSettings.php: $wgSkipSkins = array(&#8220;chick&#8221;, &#8220;cologneblue&#8221;, &#8220;myskin&#8221;, &#8220;nostalgia&#8221;, &#8220;simple&#8221;, &#8220;standard&#8221;, &#8220;modern&#8221;); 2. In your skins folder, create a file within a subfolder (for instance [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how we set up Google Adsense to show in MediaWiki 1.13.0</p>
<p>1. Force the monobook skin for everyone (unless you want to edit every skin&#8230;) by putting this setting in LocalSettings.php:<br />
<blockquote>$wgSkipSkins = array(&#8220;chick&#8221;, &#8220;cologneblue&#8221;, &#8220;myskin&#8221;, &#8220;nostalgia&#8221;, &#8220;simple&#8221;, &#8220;standard&#8221;, &#8220;modern&#8221;);</p></blockquote>
<p>2. In your skins folder, create a file within a subfolder (for instance &#8220;adsense/adsense_vertical.php&#8221;) with the following content (edit with your own Google Adsense code, also, make sure to choose a VERTICAL ad, since we are adding code in the left sidebar!):<br />
<blockquote>&lt;div id=&#8221;v-g-ads&#8221; class=&#8221;portlet&#8221;&gt;<br />&lt;h5&gt;Google ads&lt;/h5&gt;<br />&lt;div class=&#8221;pBody&#8221;&gt;<br />&lt;script type=&#8221;text/javascript&#8221;&gt;&lt;!&#8211;<br />google_ad_client = &#8220;pub-9471398824076666&#8243;;<br />/* 120&#215;240 for ZenGamers sidebar */<br />google_ad_slot = &#8220;3512091103&#8243;;<br />google_ad_width = 120;<br />google_ad_height = 240;<br />//&#8211;&gt;<br />&lt;/script&gt;<br />&lt;script type=&#8221;text/javascript&#8221;<br />src=&#8221;http://pagead2.googlesyndication.com/pagead/show_ads.js&#8221;&gt;<br />&lt;/script&gt;<br />&lt;/div&gt;<br />&lt;/div&gt;</p></blockquote>
<p>3. Edit MonoBook.php as follow:<br />Replace:<br />
<blockquote> function languageBox() {<br />  if( $this-&gt;data['language_urls'] ) { <br />?&gt;<br /> &lt;div id=&#8221;p-lang&#8221; class=&#8221;portlet&#8221;&gt;<br />  &lt;h5&gt;&lt;?php $this-&gt;msg(&#8216;otherlanguages&#8217;) ?&gt;&lt;/h5&gt;<br />  &lt;div class=&#8221;pBody&#8221;&gt;<br />   &lt;ul&gt;<br />&lt;?php  foreach($this-&gt;data['language_urls'] as $langlink) { ?&gt;<br />    &lt;li class=&#8221;&lt;?php echo htmlspecialchars($langlink['class'])?&gt;&#8221;&gt;&lt;?php<br />    ?&gt;&lt;a href=&#8221;&lt;?php echo htmlspecialchars($langlink['href']) ?&gt;&#8221;&gt;&lt;?php echo $langlink['text'] ?&gt;&lt;/a&gt;&lt;/li&gt;<br />&lt;?php  } ?&gt;<br />   &lt;/ul&gt;<br />  &lt;/div&gt;<br /> &lt;/div&gt;<br />&lt;?php<br />  }<br /> }</p></blockquote>
<p>With:<br />
<blockquote> function languageBox() {<br />  if( $this-&gt;data['language_urls'] ) { <br />?&gt;<br /> &lt;div id=&#8221;p-lang&#8221; class=&#8221;portlet&#8221;&gt;<br />  &lt;h5&gt;&lt;?php $this-&gt;msg(&#8216;otherlanguages&#8217;) ?&gt;&lt;/h5&gt;<br />  &lt;div class=&#8221;pBody&#8221;&gt;<br />   &lt;ul&gt;<br />&lt;?php  foreach($this-&gt;data['language_urls'] as $langlink) { ?&gt;<br />    &lt;li class=&#8221;&lt;?php echo htmlspecialchars($langlink['class'])?&gt;&#8221;&gt;&lt;?php<br />    ?&gt;&lt;a href=&#8221;&lt;?php echo htmlspecialchars($langlink['href']) ?&gt;&#8221;&gt;&lt;?php echo $langlink['text'] ?&gt;&lt;/a&gt;&lt;/li&gt;<br />&lt;?php  } ?&gt;<br />   &lt;/ul&gt;<br />  &lt;/div&gt;<br /> &lt;/div&gt;<br />&lt;?php<br />  }<br /> if(!strstr($_SERVER['REQUEST_URI'], &#8220;Special:&#8221;) &#038;&#038;<br /> !strstr($_SERVER['REQUEST_URI'], &#8220;action=submit&#8221;) &#038;&#038;<br /> !strstr($_SERVER['REQUEST_URI'], &#8220;action=edit&#8221;) &#038;&#038;<br /> !strstr($_SERVER['REQUEST_URI'], &#8220;Template:&#8221;)) include(&#8220;adsense/adsense_vertical.php&#8221;);<br /> }</p></blockquote>
<p>4. Upload the stuff (don&#8217;t forget there are 2 files to upload, not just one)&#8230; and wait for Adsense to crawl your pages <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/209/google-adsense-in-mediawiki-1130/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>MediaWiki &#8211; customize standard deletion reasons</title>
		<link>http://notepad.patheticcockroach.com/204/mediawiki-customize-standard-deletion-reasons/</link>
		<comments>http://notepad.patheticcockroach.com/204/mediawiki-customize-standard-deletion-reasons/#comments</comments>
		<pubDate>Fri, 16 May 2008 06:13:00 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=204</guid>
		<description><![CDATA[This is quite hard to find when you don&#8217;t have sysop rights on any wiki, and thus can&#8217;t the the delete reason drop-down list to be able to search for it. So here they are, just for you , the pages you want to edit if you want to add custom reasons for deletion in [...]]]></description>
			<content:encoded><![CDATA[<p>This is quite hard to find when you don&#8217;t have sysop rights on any wiki, and thus can&#8217;t the the delete reason drop-down list to be able to search for it. So here they are, just for you <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> , the pages you want to edit if you want to add custom reasons for deletion in the drop-down menu of the delete page:<br />For pages, the reasons are in <a href="http://www.zengamers.com/index.php?title=MediaWiki:Deletereason-dropdown">MediaWiki:Deletereason-dropdown</a><br />For files, the reasons are in <a href="http://www.zengamers.com/index.php?title=MediaWiki:Filedelete-reason-dropdown">MediaWiki:Filedelete-reason-dropdown</a><br />This was checked in MediaWiki 1.12.0, but is probably the same in any version which contains these drop-down lists.</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/204/mediawiki-customize-standard-deletion-reasons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MediaWiki maintenance &#8211; removing deleted revisions</title>
		<link>http://notepad.patheticcockroach.com/198/mediawiki-maintenance-removing-deleted-revisions/</link>
		<comments>http://notepad.patheticcockroach.com/198/mediawiki-maintenance-removing-deleted-revisions/#comments</comments>
		<pubDate>Wed, 07 May 2008 21:10:00 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=198</guid>
		<description><![CDATA[Ok, this is something which was a bit hard to find, basically because &#8220;deleting deleted stuff&#8221; isn&#8217;t really an easy search&#8230; So here we go, how to definitely remove from the database some useless junk, aka deleted revisions and deleted files.As usual, we used the latest MediaWiki version available at time of writing, which is [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, this is something which was a bit hard to find, basically because &#8220;deleting deleted stuff&#8221; isn&#8217;t really an easy search&#8230; So here we go, how to definitely remove from the database some useless junk, aka deleted revisions and deleted files.<br />As usual, we used the latest MediaWiki version available at time of writing, which is version 1.12.0.</p>
<p>Extra-requirements (eg, what&#8217;s needed apart from the normal stuff to run MediaWiki): php command line (for php5, the package is php5-cli).</p>
<p>1. Make A BACKUP of your database and image folder first (NB: in the images folder, you don&#8217;t need to nackup the &#8220;temp&#8221; and &#8220;thumb&#8221; directories)</p>
<p>2. Go, with the console, to the maintenance folder of the wiki.</p>
<p>3. To erase the deleted files, type:<br />
<blockquote>php deleteArchivedFiles.php &#8211;delete</p></blockquote>
<p>If you get messages of files not found in group &#8216;deleted&#8217;, it probably means that you already deleted these files manually. In this case you need to finish the job by emptying the [your_database_prefix]filearchive table manually (eg with phpMyAdmin).</p>
<p>4. To erase the deleted revisions, type:<br />
<blockquote>php deleteArchivedRevisions.php &#8211;delete</p></blockquote>
<p>(NB: this basically empties the [your_database_prefix]archive table)<br />Then, you must delete also the *text* of these revisions, using the following:<br />
<blockquote>php purgeOldText.php &#8211;purge</p></blockquote>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_d09ZXVPOyrI/SCIe7rUmvGI/AAAAAAAAAAQ/tWdBt8Xsu9c/s1600-h/mediawiki_delete_archives.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_d09ZXVPOyrI/SCIe7rUmvGI/AAAAAAAAAAQ/tWdBt8Xsu9c/s400/mediawiki_delete_archives.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5197750930529238114" /></a></p>
<p>That&#8217;s all, don&#8217;t forget to browse around your wiki a bit to make sure everything is fine. Also, note that this doesn&#8217;t clean up the deletion log. So when trying to re-create a page that was previously deleted and the erased as above, you&#8217;ll still have a &#8220;restore&#8221; option. But the restoration page will have no revisions and/or files available for restoration.</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/198/mediawiki-maintenance-removing-deleted-revisions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
