Katlas installation notes: Difference between revisions

From Knot Atlas
Jump to navigationJump to search
m (Reverted edits by LapasOrsit (Talk); changed back to last version by Drorbn)
 
(47 intermediate revisions by 9 users not shown)
Line 1: Line 1:
On July 14, 2007 we've upgraded MediaWiki to version 1.10.1. The pre-upgrade installation notes are at [[MediaWiki 1.4 installation notes]].
This page is [http://math.berkeley.edu/~scott/wiki/Katlas_installation_notes mirrored on Scott's wiki].


===Fixing search===
Okay... these are our notes while trying to setup [http://katlas.math.toronto.edu/wiki/ the wiki on katlas].
In file <tt>/www/html/w/skins/MonoBook.php</tt> change <tt>&lt;form ... id="searchform"&gt;</tt> to <tt>&lt;form method=post ... id="searchform"&gt;</tt>.


==Upgrading MySQL==
===Rendering PNG===
Follow the instructions at http://mywiki.ncsa.uiuc.edu/wiki/MediaWiki_Servers#Problems_Rendering_PNG_Images:
For better or worse, I decided to upgrade MySQL to version 4.0 before doing anything else. I mostly followed [http://dev.mysql.com/doc/mysql/en/linux-rpm.html these instructions].
*Add to LocalSettings.php

''Warning: do not install MySQL 4.1. It is incompatible with mediawiki. Install version 4.0.''

For this I need three RPMs which are all available with only a little digging at [http://www.mysql.com/ mysql.com]
* MySQL-shared-compat-4.0.25-0.i386.rpm
* MySQL-server-4.0.25-0.i386.rpm
* MySQL-client-4.0.25-0.i386.rpm

The first of these is required so we don't break dependencies while upgrading. Install it first, with
:rpm -iv MySQL-shared-compat-4.0.25-0.i386.rpm
Then upgrade the other two packages
:rpm -U MySQL-server-4.0.25-0.i386.rpm
:rpm -U MySQL-client-4.0.25-0.i386.rpm

Note the warning the server install gives --
<pre>
<pre>
$wgMimeDetectorCommand = "file -bi";
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h katlas.math.toronto.edu password 'new-password'
See the manual for more instructions.
</pre>
</pre>
*then rebuild images

(note however that you need to upgrade the client package before mysqladmin is available to do this!)

I also deleted the local anonymous account, and put a password on the remote anonymous account. (Ask [[User:Scott]] for these passwords.)

==Apache==
I had to fix the server name, from katlas to katlas.math.toronto.edu in /etc/httpd/conf/httpd.conf

I added
AllowOverride FileInfo
AllowOverride AuthConfig
in the httpd.conf file, in the section for /var/www/html, so I could use .htaccess files to rewrite the wiki URLs nicely, and to disallow access to phpMyAdmin.

I added a [http://meta.wikimedia.org/wiki/Robots.txt robots.txt] file, to protect the wiki internals from spiders. --[[User:Scott|Scott]] 12:44, 19 Aug 2005 (EDT)

I moved the document root from /var/www/html to /www/html. (Actually, I moved everything in /var/www to /www) This required the following steps
# in /var/www, as root <pre>cp -R --preserve * /www</pre>
# in httpd.conf, replacing /var/www everywhere with /www
# in LocalSettings.php replacing /var/www with /www in the $IP line
# test everything seems to work!
# in /var, as root, <pre>rm -Rf www</pre>
--[[User:Scott|Scott]] 12:44, 19 Aug 2005 (EDT)

This messed up webalizer, however, so I modified the appropriate line in /etc/webalizer.conf. I also added a section in http.conf to make /usage world-readable. --[[User:Scott|Scott]] 13:03, 19 Aug 2005 (EDT)

Restarting apache is best achieved by (as root)
<pre>/usr/sbin/apachectl graceful</pre>
or
<pre>/etc/rc.d/init.d/httpd restart</pre>--[[User:Scott|Scott]] 13:17, 19 Aug 2005 (EDT)

Error logs can be found at /var/log/httpd --[[User:Scott|Scott]] 10:33, 26 Aug 2005 (EDT)

We had a nasty (to diagnose!) problem with uploading large files. We had to edit /etc/httpd/conf.d/php.conf, modifying the LimitRequestBody line. --[[User:Scott|Scott]] 11:08, 23 Aug 2005 (EDT)

===creating new accounts===
As root, do something like
<pre>
<pre>
# cd /www/html/w/maintenance
$ htpasswd -m /www/.htpasswd sally
# php rebuildImages.php
New password: *******
Processing image...
Re-type new password: *******
Finished image... 3 of 4 rows updated
Adding password for user sally
Processing oldimage...
Finished oldimage... 2 of 2 rows updated
#
</pre>
</pre>


===Creating nice thumbnails with ImageMagick===
==phpMyAdmin==
Unfortunately, they've broken things in mediawiki 1.10, and creating thumbnails of transparent gifs is horrible. If you make the following changes to /includes/media/Bitmap.php, things should behave just like in mediawiki 1.4 (i.e. perfectly, for our purposes).
Just unzip'd it into phpMyAdmin, editted the config.inc.php, created a .htpassword file and added a <nowiki><Directory></nowiki> entry to httpd.conf --[[User:Scott|Scott]] 10:34, 26 Aug 2005 (EDT)

==MediaWiki==
I added the namespace "Data", and later "Article", as per [http://meta.wikimedia.org/wiki/Help:Custom_namespaces these instructions], adding
<pre>
<pre>
// replacing this all with something much simpler from around mediawiki 1.4
$wgExtraNamespaces =
# $cmd = wfEscapeShellArg($wgImageMagickConvertCommand) .
array(100 => "Data",
# " {$quality} -background white -size {$physicalWidth} ".
101 => "Data_talk",
102 => "Article",
# wfEscapeShellArg($srcPath) .
# // Coalesce is needed to scale animated GIFs properly (bug 1017).
103 => "Article_talk");
# ' -coalesce ' .
# Enable subpages in the knot data namespace
# // For the -resize option a "!" is needed to force exact size,
$wgNamespacesWithSubpages[100] = 1;
# // or ImageMagick may decide your ratio is wrong and slice off
$wgNamespacesWithSubpages[101] = 1;
# // a pixel.
$wgNamespacesWithSubpages[102] = 1;
# " -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) .
$wgNamespacesWithSubpages[103] = 1;
# " -depth 8 $sharpen " .
# wfEscapeShellArg($dstPath) . " 2>&1";
// here's what we used to do, back in mediawiki 1.4, and it works great.
$cmd = wfEscapeShellArg($wgImageMagickConvertCommand) .
" {$quality} -background white -geometry {$physicalWidth} ".
wfEscapeShellArg($srcPath) . " " .
wfEscapeShellArg($dstPath) . " 2>&1";
</pre>
</pre>
to LocalSettings.php. Do not use spaces in the namespace names, only underscores.

===Enable <nowiki><math></math></nowiki> processing===
First, I made the /images directory writable.

Next, I installed ocaml (download the sources, ./configure, make world, make bootstrap, make opt, make install). What a pain! After that, go to the math directory under the wiki installation, and run make.

Finally, edit LocalSettings.php to enable TeX.

Later, we started modifying texvc, to allow more symbols from amssymb, and to allow use of Dror's [http://www.math.toronto.edu/~drorbn/projects/dbnsymb/dbnsymbman.html dbnsymb]. This required modifications to [[Texutil.ml]], and recompiling texvc (just run make). --[[User:Scott|Scott]] 15:10, 29 Aug 2005 (EDT)

====Installing the Font dbnsymb====

# Download the files dbnsymb.mf and dbnsymb.sty from [http://www.math.toronto.edu/~drorbn/projects/dbnsymb/dbnsymbman.html].
# Put dbnsymb.mf at "/usr/share/texmf/fonts/source/public".
# Put dbnsymb.sty at "/usr/share/texmf/tex/latex/misc".
# Run the command "texhash".

===Allowing .zip and .gif uploads===
In LocalSettings.php I added the line
<pre>
$wgFileExtensions = array( 'png','gif','jpg','jpeg','ogg','mp3','pdf','zip','gz','nb','m','lhs');
</pre>

===Marking users as bots===
See [http://meta.wikimedia.org/wiki/Setting_user_rights_in_MediaWiki]. Note that all our tables have the prefix mw_. As far as I can tell, you have to guess the user number (or you can log in as that user, and go to Preferences).



===Modifying the navigation box===
===Modifying the navigation box===
Edit [[MediaWiki:Sidebar]].
Follow the instructions at [http://meta.wikimedia.org/wiki/MediaWiki_FAQ#How_to_customize_your_own_navigation_bar]
# Make changes to LocalSettings.php
# edit the pages Mediawiki:todo, Mediawiki:todo-url, Mediawiki:rolfsen, Mediawiki:rolfsen-url, etc. (these pages are protected.)

Note that this will change in mediawiki 1.5, and become a lot easier.


===Add "tour" sidebar box===
===Add "tour" sidebar box===
In skins/MonoBook.php, right above the line beginning with
In skins/MonoBook.php, right above the lines
<?php
<?php if( $this->data['language_urls'] )
if( $this->data['language_urls'] ) { ?>
add lines as follows:<pre><nowiki>
add lines as follows:<pre><nowiki>
<div class="portlet" id="p-tour">
<div class="portlet" id="p-tour">
Line 145: Line 70:
</div>
</div>
</nowiki></pre>
</nowiki></pre>
(this will surely change as we understand MediaWiki better)


===Modifying the logo===
==="Redraw Page" tab===
Grab [[Image:The_Knot_Atlas.png|36px]], resize it to 145x145, save it as /www/html/w/skins/common/images/katlas.png, and put the line
$wgLogo = "$wgStylePath/common/images/katlas.png";
in LocalSettings.php. Also, grab [[Image:favicon.png|16px]], convert it to Windows .ico format and save it as favicon.ico at /www/html (not /www/html/w !).


Add to [[MediaWiki:Monobook.js]], following [http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/Add_purge_to_tabs Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs]:
===Hacking mediawiki===
I modified [[ImagePage.php]] so redirects on image pages don't produce a spurious copy of the image. There's [http://bugzilla.wikimedia.org/show_bug.cgi?id=539 a bug] on bugzilla, where a different fix is being proposed. There's [http://meta.wikimedia.org/wiki/User:Sysy/Joshua_Oreman%27s_icon_extension another (not so good?) solution] as an extension.


addOnloadHook(function () {
Later, I modified [[Math.php]], so if a math .png file is missing, but isn't immediately needed, it isn't regenerated. This let's us delete .png files from /w/images/math. To avoid creating too many such .png images in the first place, any robots uploading math formulas should have 'Leave TeX' set in their math preferences. --[[User:69.110.11.59|69.110.11.59]] 04:59, 21 Sep 2005 (EDT)
var hist; var url;
if (!(hist = document.getElementById('ca-history') )) return;
if (!(url = hist.getElementsByTagName('a')[0] )) return;
if (!(url = url.href )) return;
addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
'redraw page', 'ca-purge', 'Purge server cache for this page', '0');
});


===Fixing search===
===Spam filtering===
Follow the directions at http://www.mediawiki.org/wiki/Extension:SpamBlacklist
In file <tt>/www/html/w/skins/MonoBook.php</tt> within <tt>&lt;form name="searchform" ... &gt;</tt> add <tt>method="post"</tt>.


===Automatic "&action=purge"===
===Tweaking the job queue===
Running jobs seems to slow everything down horribly. It's '''essential''' that you add
In file <tt>/www/html/w/index.php</tt> change the line reading <tt>$action = $wgRequest->getVal( 'action', 'view' );</tt> to <tt>$action = $wgRequest->getVal( 'action', 'purge' );</tt>.
<pre>
$wgJobRunRate = 0.01;
</pre>
to <code>LocalSettings.php</code>. It may prove necessary to add a cron job running <code>/w/maintenance/runJobs.php</code>, if the length of the job queue (see [[Special:Statistics]]) gets out of hand. This should only happen after edits to widely used templates.


In an attempt to stop the job queue from processing latex, Scott added a line to <code>includes/JobQueue.php</code>.
===Several Wikis===
<pre>
Allow logins on several wikis on the same server: Add the following line to LocalSettings.php after <code>$wgSiteName = ...</code>:
$options = new ParserOptions;
ini_set("session.name", "KnotAtlasSession" );
// turning off math rendering while processing jobs, because it's a terrible idea.
$options->setUseTeX( false );
</pre>


===Spam blacklists===
===Installing ParserFunctions===
In order to use template-like parser functions, such as <code>{{#ifexist:<pagename>|<true>|<false>}}</code>, we need to enable the ParserFunctions extension, following the instructions at http://meta.wikimedia.org/wiki/ParserFunctions.
After surviving several annoying spam attacks on my private wiki, I learnt how to deal with it, and I'm applying what I've learnt here. See /w/extensions/SpamBlacklist for the spam blacklist extension, and LocalSettings.php for the changes required there. Things should just work. Even better, if you're a sysop, you can just edit the page [[Local spam blacklist]] to add regular expressions. I've downloaded the latest copy of the [http://meta.wikimedia.org/wiki/Spam_blacklist spam blacklist from meta], but we should update it more often. Updating it is simply a matter of running /www/html/w/extensions/SpamBlacklist/load_lists --[[User:Scott|Scott]] 13:20, 29 Sep 2005 (EDT)


Download the files
Can we create a cron job for /www/html/w/extensions/SpamBlacklist/load_lists, or add it to our backup script? --[[User:Scott|Scott]] 13:20, 29 Sep 2005 (EDT)
* [http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ParserFunctions/Expr.php Expr.php]
* [http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ParserFunctions/ParserFunctions.php ParserFunctions.php]
* [http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ParserFunctions/ParserFunctions.i18n.php ParserFunctions.i18n.php]
and then add a line to LocalSettings.php:
<pre>
require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
</pre>


====Referer Spam====
===Installing a PHP cache===
Look at http://meta.wikimedia.org/wiki/PHP_caching_and_optimization.
To combat [http://www.spywareinfo.com/articles/referer_spam/ referer spam], I added a referer's black list as [http://www.joemaller.com/htaccess.txt here] to <tt>/www/html/.htaccess</tt>, with some additions of my own following the log files. More should be added as needed. --[[User:Drorbn|Drorbn]] 09:33, 10 May 2006 (EDT)


# Install PEAR, by saving http://go-pear.org/ as <code>/home/wiki/pear/go-pear.php</code>, then running <code>php go-pear.php</code> and following the prompts
===Upgrading mediawiki===
# Install APC, by running <code>/home/wiki/pear/bin/pecl install apc</code>
katlas hasn't been upgraded from mediawiki 1.4.7 since it was first set up. Scott's successfully upgraded several other wikis, however.
# Add <code>extension=apc.so</code> to <code>/etc/php.ini</code>
Here's a recipe:
#mv w w-old
#gzip -d mediawiki-[version].tar.gz
#tar xvf mediawiki-[version].tar
#mv mediawiki-[version] w
#chmod a+w w/config
#Go to http://example.com/w/config/ and fill in all the fields. It's useful to have w-old/LocalSettings.php open as you do this, as many of the fields can be copied from this.
#If installation is successful, follow the instructions: mv w/config/LocalSettings.php w/
#Go through the new and old LocalSettings.php files, migrating changes across to the new LocalSettings.php
#Copy across the contents of the images/ directory.
#Remember to set permissions on the images/ directory (probably <code>chmod -R g+w images</code>).
#If appropriate, copy across the math/ directory, containing our hacks (allowing use of dbnsymb, amongst other things).


You can see APC's statistics at http://katlas.org/apc.php
Actually, this wasn't entirely successful. Dror subsequently discovered that LaTeX support was broken, and that new pages couldn't be created. --[[User:Scott|Scott]] 13:00, 28 Mar 2006 (EST)


Add
The new page problem is because the spam blacklist extension installed is not compatible with mediawiki 1.5. We need to download a new copy of the spam blacklist extension for any wikis we upgrade to 1.5, from [http://cvs.sourceforge.net/viewcvs.py/wikipedia/extensions/SpamBlacklist/]. Alternatively, is should be safe to copy it from the omath wiki. The LaTeX support was broken because I hadn't made the images directory group writable (or, for that matter, copied across the images directory!) --[[User:Scott|Scott]] 13:28, 28 Mar 2006 (EST)

==Server security==
Everyday we have scripts come through trying to login through sshd, with various user/pass combinations. If we need to a solution we could either
# move sshd to listen on another port
# install on the the scripts described at http://www.linux.com/article.pl?sid=05/09/15/1655234

==up2date and python==
At some point I installed version 2.4 of python on katlas; we previously had version 2.2 installed, and something (I can't remember what) needed a more recent version. However, I never worked out how to properly install new python modules, and, as a result, there's various stuff missing from the python 2.4 installation, in particular the rpm module. This causes redhat's "up2date" program to fail, which is serious, as this is the main mechanism for automatically installing security updates from redhat. --[[User:Scott|Scott]] 08:36, 3 Apr 2006 (EDT)

===Work around===
In /usr/bin, you'll find files "python2.2", "python2.4" and "python". "python2.2" is a copy of the originally installed "python"; "python2.4" is a symbolic link to my installation of python 2.4. Currently, the file "python" is an exact copy of the file "python2.2". Things seem to work; in particular, "up2date" runs again.

If you find something that needs python 2.4 (happily, running up2date brought the honest version of python up to 2.3), you could try replacing "python" with "python2.4", but I really wouldn't recommend it. --[[User:Scott|Scott]] 08:36, 3 Apr 2006 (EDT)

===Running up2date===
Running up2date for the first time in a long while seemed to work just fine. It complained about two sendmail configuration files, and made new versions with .rpmnew appended, but there were no essential differences. --[[User:Scott|Scott]] 09:45, 3 Apr 2006 (EDT)

We should check with the toronto math department computer people to see if they're now happy with katlas.

==Subversion==
We have a working subversion server going now. (I had to find the RHEL3 rpm, but it was easy after that!)

We have several separate repositories, and it's easy (for root) to create more. Go to one of
*http://katlas.math.toronto.edu/svn/KnotAtlas
*http://katlas.math.toronto.edu/svn/KnotTheory
*http://katlas.math.toronto.edu/svn/WikiLink
*http://katlas.math.toronto.edu/svn/QuantumGroups
*http://katlas.math.toronto.edu/svn/Tungsten
to get started.

To create a new repository, type something like
<pre>
<pre>
# See http://www.mediawiki.org/wiki/Manual:%24wgMainCacheType
svnadmin create RepositoryName /home/svn
$wgMainCacheType = CACHE_ACCEL;
</pre>
</pre>
to <code>LocalSettings.php</code>.
then change the ownership and permissions to match the other repositories. (The easiest way to do this is to login as svn, before using svnadmin, then <code>chmod -R g+w /home/svn/RepositoryName</code> to allow commits via the web.)


===Installing memcached===
There's read-only public access; to commit changes you'll need to [[#creating new accounts|create an account]]. For windows, download [http://tortoisesvn.tigris.org/ TortoiseSVN], for eclipse use subclipse.
In my continuing quest for faster page loads, I'm trying memcached. Follow the nice instructions at http://blog.ajohnstone.com/archives/installing-memcached/.


Although it's not installed, it's not running, or being used. See http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/docs/memcached.txt?view=markup for instructions for actually running it. You'll probably need to uncomment some lines in LocalSettings.php too.
I've set up fine grained access control, as per [http://svnbook.red-bean.com/en/1.2/svn-book.html#svn.serverconfig.httpd.authz.perdir instructions in the SVN Book]. You'll need to edit <code>/home/svn/svnaccess.conf</code> to grant people access to the repositories. --[[User:Scott|Scott]] 20:26, 9 Oct 2006 (EDT)


===Updating CSS and JS===
Some people have had trouble with Mathematica notebooks in version control, although so far it's been fine for us. There are several solutions people have come up with. Do be very careful when resolving conflicts, on the other hand!
* Write [http://en.wikipedia.org/wiki/MediaWiki:Common.css MediaWiki:Common.css] on top of the local [[MediaWiki:Common.css]].
*http://www.itwm.fhg.de/as/asemployees/wichmann/nbcache.html A perl script for stripping out the cache data.
* Write [http://en.wikipedia.org/wiki/MediaWiki:Monobook.css MediaWiki:Monobook.css] on top of the local [[MediaWiki:Monobook.css]].
*Using the ShowShortBoxForm option in Mathematica [http://forums.wolfram.com/mathgroup/archive/2005/Mar/msg00175.html], which apparently makes notebooks less prone to arbitrary changes independent of real content changes.
* Write [http://en.wikipedia.org/wiki/MediaWiki:Common.js MediaWiki:Common.js] on top of the local [[MediaWiki:Common.js]] being super-careful not to step on any of our extensions.


===Increasing PHP's memory_limit===
==iptables==
In LocalSettings.php, change
Arno's iptables is the way to go. Just edit
ini_set( 'memory_limit', '20M' );
to
ini_set( 'memory_limit', '40M' );


===Fixing "Random Page"===
<pre>
/etc/iptables-firewall.conf
</pre>

To restart, use
<pre>
/etc/init.d/rc.iptables restart
</pre>


The standard MediaWiki [[Special:Random|random page]] algorithm is strange, and anyway unsuitable for our purposes. See [[Fixing "Random Page"]] for the details and for our fix.
==Fisheye and Jira==
*run /home/fisheye/server/bin/start.sh and /home/jira/server/bin/startup.sh to start them
*to allow fisheye access to a new repository, see http://www.cenqua.com/fisheye/doc/1.1/admin/svnallow.html
*I modified /etc/rc.d/rc.local to automatically start fisheye and jira.
*getting the automatic proxying working on the new server required copying [[/etc/conf/httpd/conf.d/jira.conf]] over.

Latest revision as of 18:10, 8 January 2009

On July 14, 2007 we've upgraded MediaWiki to version 1.10.1. The pre-upgrade installation notes are at MediaWiki 1.4 installation notes.

Fixing search

In file /www/html/w/skins/MonoBook.php change <form ... id="searchform"> to <form method=post ... id="searchform">.

Rendering PNG

Follow the instructions at http://mywiki.ncsa.uiuc.edu/wiki/MediaWiki_Servers#Problems_Rendering_PNG_Images:

  • Add to LocalSettings.php
$wgMimeDetectorCommand = "file -bi"; 
  • then rebuild images
# cd /www/html/w/maintenance
# php rebuildImages.php 
Processing image...
Finished image... 3 of 4 rows updated
Processing oldimage...
Finished oldimage... 2 of 2 rows updated
#

Creating nice thumbnails with ImageMagick

Unfortunately, they've broken things in mediawiki 1.10, and creating thumbnails of transparent gifs is horrible. If you make the following changes to /includes/media/Bitmap.php, things should behave just like in mediawiki 1.4 (i.e. perfectly, for our purposes).

                        // replacing this all with something much simpler from around mediawiki 1.4
                        # $cmd  =  wfEscapeShellArg($wgImageMagickConvertCommand) .
                        #       " {$quality} -background white -size {$physicalWidth} ".
                        #       wfEscapeShellArg($srcPath) .
                        #       // Coalesce is needed to scale animated GIFs properly (bug 1017).
                        #       ' -coalesce ' .
                        #       // For the -resize option a "!" is needed to force exact size,
                        #       // or ImageMagick may decide your ratio is wrong and slice off
                        #       // a pixel.
                        #       " -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) .
                        #       " -depth 8 $sharpen " .
                        #       wfEscapeShellArg($dstPath) . " 2>&1";
                        // here's what we used to do, back in mediawiki 1.4, and it works great.
                        $cmd  =  wfEscapeShellArg($wgImageMagickConvertCommand) .
                                " {$quality} -background white -geometry {$physicalWidth} ".
                                wfEscapeShellArg($srcPath) . " " .
                                wfEscapeShellArg($dstPath) . " 2>&1";

Modifying the navigation box

Edit MediaWiki:Sidebar.

Add "tour" sidebar box

In skins/MonoBook.php, right above the lines

<?php
                if( $this->data['language_urls'] ) { ?>

add lines as follows:

        <div class="portlet" id="p-tour">
          <h5><a href="/wiki/Tour_of_the_Knot_Atlas">tour</a></h5>
          <div class="pBody">
            <ul>
            <li><a href="/wiki/5_2">5 2</a> (edit me!)
            <li><a href="/wiki/5_2_Quantum_Invariants">5 2 Quantum Invariants</a>
            <li><a href="/wiki/L10n85">L10n85</a>
            <li><a href="/wiki/The_Multivariable_Alexander_Polynomial">Multivariable Alexander</a>
            <li><a href="/wiki/Knot_Atlas:About">About</a>
            <li><a href="/wiki/Data:5_2/Bridge_Index">Data:5_2/Bridge_Index</a>
            <li><a href="/wiki/The_Mathematica_Package_KnotTheory%60">Knot Theory`</a>
            <li><a href="/wiki/How_to_Edit_this_Manual...">How to Edit Manual...</a>
            <li><a href="/wiki/Modifying_Knot_Pages">Modifying Knot Pages</a>
            <li><a href="/wiki/Special:Recentchanges">Recent changes</a>
            <li><a href="/wiki/To_Do">To Do</a> (history!)
            </ul>
          </div>
        </div>

"Redraw Page" tab

Add to MediaWiki:Monobook.js, following Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs:

addOnloadHook(function () {
    var hist; var url;
    if (!(hist = document.getElementById('ca-history') )) return;
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
    if (!(url = url.href )) return;
    addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
                   'redraw page', 'ca-purge', 'Purge server cache for this page', '0');
});

Spam filtering

Follow the directions at http://www.mediawiki.org/wiki/Extension:SpamBlacklist

Tweaking the job queue

Running jobs seems to slow everything down horribly. It's essential that you add

$wgJobRunRate = 0.01;

to LocalSettings.php. It may prove necessary to add a cron job running /w/maintenance/runJobs.php, if the length of the job queue (see Special:Statistics) gets out of hand. This should only happen after edits to widely used templates.

In an attempt to stop the job queue from processing latex, Scott added a line to includes/JobQueue.php.

$options = new ParserOptions;
// turning off math rendering while processing jobs, because it's a terrible idea.
$options->setUseTeX( false );

Installing ParserFunctions

In order to use template-like parser functions, such as <false>, we need to enable the ParserFunctions extension, following the instructions at http://meta.wikimedia.org/wiki/ParserFunctions.

Download the files

and then add a line to LocalSettings.php:

require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );

Installing a PHP cache

Look at http://meta.wikimedia.org/wiki/PHP_caching_and_optimization.

  1. Install PEAR, by saving http://go-pear.org/ as /home/wiki/pear/go-pear.php, then running php go-pear.php and following the prompts
  2. Install APC, by running /home/wiki/pear/bin/pecl install apc
  3. Add extension=apc.so to /etc/php.ini

You can see APC's statistics at http://katlas.org/apc.php

Add

# See http://www.mediawiki.org/wiki/Manual:%24wgMainCacheType
$wgMainCacheType = CACHE_ACCEL;

to LocalSettings.php.

Installing memcached

In my continuing quest for faster page loads, I'm trying memcached. Follow the nice instructions at http://blog.ajohnstone.com/archives/installing-memcached/.

Although it's not installed, it's not running, or being used. See http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/docs/memcached.txt?view=markup for instructions for actually running it. You'll probably need to uncomment some lines in LocalSettings.php too.

Updating CSS and JS

Increasing PHP's memory_limit

In LocalSettings.php, change

ini_set( 'memory_limit', '20M' );

to

ini_set( 'memory_limit', '40M' );

Fixing "Random Page"

The standard MediaWiki random page algorithm is strange, and anyway unsuitable for our purposes. See Fixing "Random Page" for the details and for our fix.