Working with MediaWiki
Magic pages: MediaWiki:Mainpage MediaWiki:Sitenotice MediaWiki:Common.css
Edit sidebar
Hide toolbox unless logged in
Originally used [1], but the structure changed with an upgrade. For Vector.php, add the following in renderPortals:
if ( !$this->data['loggedin']) { $portals['TOOLBOX'] = false; }
Leaving WPtouch.php alone ... looks like the same idea doesn't work since data['loggedin'] doesn't get set.
Getting MathJax Working
I'm now using jsdelivr CDN for MathJax, following the recommendation in the MathJax documentation here, putting everything into MediaWiki:Common.js, which is run on every page.
Older MathJax
I got MathJax: git clone git://github.com/mathjax/MathJax.git MathJax
Using MathJax extension Went back to old solution; MathJax extension hiccupped.
old solution:
I installed the JavaScript extension[2] for MediaWiki.
I added a file
mathjax.js
(name doesn't matter) toextensions/JavaScript
. It's content:
var e = document.createElement('script'); e.type = "text/javascript"; e.src = "/MathJax/MathJax.js?config=wikiconfig"; document.getElementsByTagName('head')[0].appendChild(e);(I basically copied the MathJax configuration file used at MO ... got confused because you have to remember to modify the last line)
(Not) Getting Blahtex Working
It'd be much nicer to get MediaWiki to serve MathML and use MathJax to convert only if it has to, but I haven't been able to get Blahtex[3] to compile. I've been trying to follow the instructions here [4]. I'm able to checkout blahtex and to get texvc working, but if I try make
or make linux
, I get
g++ -O3 -c -o source/main.o source/main.cpp
source/main.cpp: In function ‘void ShowUsage()’:
source/main.cpp:108: error: ‘exit’ was not declared in this scope
make: *** [source/main.o] Error 1
Moving html to wiki
A useful substitution:
<a href="([^"]*)"[^>]*>([^<]*)</a>
[\1 \2]
Handling Spam
See http://www.mediawiki.org/wiki/Manual:Combating_spam
Using SpamBlacklist extension. Using blacklists at meta.wikimedia and wikipedia, and adding additional blacklisted urls to MediaWiki:Spam-blacklist as needed.
Also installed the UserMerge extension so that I can delete junk users. In extensions directory,
svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/UserMerge
Started using CAPTCHAs:
svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ConfirmEdit
Change text of the Special:Captcha/help at MediaWiki:Captchahelp-text (more generally, various bits of text are configurable through the Special:AllMessages page).
Was getting spam even when using ReCaptcha ... switched to Questycaptcha. Still got spam, but with no links, so added
$wgCaptchaTriggers['edit'] = true; $wgCaptchaTriggers['create'] = true;
Still getting spam users created pretty regularly (every two weeks?), so I'm disabling user creation with
$wgGroupPermissions['*']['createaccount'] = false;
Editing MediaWiki:Loginprompt to reflect that you need to contact me to create a user. To create a new user, visit Special:UserLogin while logged in.
Sitemap
Followed instructions here and pointed google webmasters to stacky.net/wiki/sitemap/ ... google complains the sitemap is html, so pointed to http://stacky.net/wiki/sitemap/sitemap-index-stacky_net_3-wiki_.xml instead. Still not working.
Okay, looking at Manual_talk:GenerateSitemap.php, it looks like the following thing should work. I've modified the indexEntry
function in $IP/maintenence/GenerateSitemap.php
as follows:
407c407 < "\t\t<loc>$filename</loc>\n" . > "\t\t<loc>http://stacky.net/wiki/sitemap/$filename</loc>\n" .
Regenerating with
php maintenance/generateSitemap.php --server http://stacky.net --urlpath http://stacky.net/wiki
Great, that seems to make google happy. Adding daily cron job through web panel.
Templates
Added ParserFunctions extension to allow flow control in templates.
Error creating thumbnails
This error didn't used to appear, but now does. Enabling logging, I see the following behavior when I try to produce a 45px wide version of New.jpg:
File::transform: Doing stat for /home/ageraschenko/stacky.net/wiki/images/thumb/2/2d/New.jpg/45px-New.jpg BitmapHandler::doTransform: creating 45x38 thumbnail at /home/ageraschenko/stacky.net/wiki/images/thumb/2/2d/New.jpg/45px-New.jpg BitmapHandler::doTransform: scaler im BitmapHandler::doTransform: running ImageMagick: '/usr/bin/convert' -quality 80 -background white -size 45 '/home/ageraschenko/stacky.net/wiki/images/2/2d/New.jpg' -thumbnail '45x38!' -set comment 'File source: http://stacky.net/wiki/index.php?title=File:New.jpg' -depth 8 -sharpen '0x0.4' '/home/ageraschenko/stacky.net/wiki/images/thumb/2/2d/New.jpg/45px-New.jpg' 2>&1 wfShellExec: '/home/ageraschenko/stacky.net/wiki/bin/ulimit4.sh' 180 102400 102400 ''\''/usr/bin/convert'\'' -quality 80 -background white -size 45 '\''/home/ageraschenko/stacky.net/wiki/images/2/2d/New.jpg'\'' -thumbnail '\''45x38!'\'' -set comment '\''File source: http://stacky.net/wiki/index.php?title=File:New.jpg'\'' -depth 8 -sharpen '\''0x0.4'\'' '\''/home/ageraschenko/stacky.net/wiki/images/thumb/2/2d/New.jpg/45px-New.jpg'\'' 2>&1' thumbnail failed on grumium: error 2 "" from "'/usr/bin/convert' -quality 80 -background white -size 45 '/home/ageraschenko/stacky.net/wiki/images/2/2d/New.jpg' -thumbnail '45x38!' -set comment 'File source: http://stacky.net/wiki/index.php?title=File:New.jpg' -depth 8 -sharpen '0x0.4' '/home/ageraschenko/stacky.net/wiki/images/thumb/2/2d/New.jpg/45px-New.jpg' 2>&1"
Weirdly, commenting out the line
$wgUseImageMagick = true;
in LocalSettings.php
seems to fix the problem.
Finding Broken Links
Using the BrokenLinks extension, but it seems dodgy ... often the links it objects to work just fine.
Also handy: XHTML validator link checker
Restricted access to certain pages
[Not working] Citations/references
I tried cloning [6], but it doesn't work, probably because this version of MediaWiki is so old.
old Cite
Trunk of svn repo doesn't seem to work. Did this instead, as recommended at [7]
wget http://upload.wikimedia.org/ext-dist/Cite-MW1.16-r62678.tar.gz tar -xzf Cite-MW1.16-r62678.tar.gz -C /var/www/mediawiki/extensions
Setting up knotica
Have knotica add a CNAME record pointing "@" to "knotica.stacky.net". Have dreamhost fully host "knotica.sheafy.net". Mirror "knotica.com" at "knotica.sheafy.net".
One-click install mediawiki to "knotica.stacky.net/wiki".
Setting up mail
$wgSMTP = array( 'host' => 'ssl://smtp.gmail.com', 'IDHost' => 'mydomain.com', 'port' => 465, 'username' => 'webmaster@mydomain.com', ## or info@mydomain.com, or whatever email account you've set up for your Mediawiki installation 'password' => 'emailpasswordforwebmaster', 'auth' => true );
Mobile support
Tried MobileFrontend extension, but it gives me errors. In extensions directory,
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/MobileFrontend.git
then in LocalSettings
require_once("$IP/extensions/MobileFrontend/MobileFrontend.php"); $wgMFAutodetectMobileView = true;
Trying again, using instructions at [9].
wget http://www.memorydeleted.com/mediawiki/skins/WPtouch_1.18_and_later.zip unzip WPtouch_1.18_and_later.zip
put WPtouch.php
and wptouch/
into skins/
. Edit LocalSettings to say
if (preg_match("/(mobile|webos|opera mini)/i", $_SERVER['HTTP_USER_AGENT'])) { // Different file cache dir for mobile devices $wgCacheDirectory = "$IP/cache_mobile"; // Mobile skin $wgDefaultSkin = 'wptouch'; } else { // normal skin $wgDefaultSkin = "vector"; }
Create cache_mobile dir with same permissions as cache dir and "Deny from all" .htaccess file.
In WPtouch.php
, replace /apple-touch-icon.png
with /wiki/favicon.ico
.
Drafts: not working
Drafts extension doesn't seem to work. It's unmaintained and there's some issue that causes saving drafts to always fail. Oh well.
Markdown
First installing composer with
curl -sS https://getcomposer.org/installer | php
(run from the wiki directory)
php composer.phar require benjaminhoegh/parsedown-extended
git clone https://github.com/kuenzign/WikiMarkdown.git
create composer.local.json with contents
{ "extra": { "merge-plugin": { "include": [ "extensions/WikiMarkdown/composer.json" ] } } }
Add
wfLoadExtension( 'WikiMarkdown' );