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)
 
(8 intermediate revisions by 4 users not shown)
Line 88: Line 88:


===Tweaking the job queue===
===Tweaking the job queue===
Running jobs seems to slow everything down horribly. It's '''essential''' that you add
<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>.
In an attempt to stop the job queue from processing latex, Scott added a line to <code>includes/JobQueue.php</code>.
<pre>
<pre>
Line 96: Line 102:


===Installing ParserFunctions===
===Installing ParserFunctions===
In order to use template-like parser functions, such as <code>{{#ifexists:<pagename>|<true>|<false>}}</code>, we need to enable the ParserFunctions extension, following the instructions at http://meta.wikimedia.org/wiki/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.


Download the files
Download the files
Line 132: Line 138:
* Write [http://en.wikipedia.org/wiki/MediaWiki:Monobook.css MediaWiki:Monobook.css] on top of the local [[MediaWiki:Monobook.css]].
* Write [http://en.wikipedia.org/wiki/MediaWiki:Monobook.css MediaWiki:Monobook.css] on top of the local [[MediaWiki:Monobook.css]].
* 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.
* 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===
In LocalSettings.php, change
ini_set( 'memory_limit', '20M' );
to
ini_set( 'memory_limit', '40M' );

===Fixing "Random Page"===

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.

Latest revision as of 17: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.