Program Installation
From WhiteWing
Jump to: navigation, search

Contents

Development Setting

  • Eclipse
    • Subclipse : svn
    • PyDev : Python IDE

Installing ImageMagick

  • ImageMagick-6.3.2
  • Although I found a way to use Mediawiki-math without convert command, I still need ImageMagic for auto-thumbnails.
  • ./configure --prefix=$HOME/local --without-perl --without-magick-plus-plus --disable-openmp

Installing Mediawiki

  • uni.nayana.com does not support php5, so we cannot install the newest version. I downloaded version 1.6.10. There is an error
    failed with error code "Specified key was too long"
    which happened before. I guess this is because I'm using utf8[1].

Installing Mediawiki-Math

  • To install math package, you need ocamlopt. Install ocaml.
    ./configure -prefix ~/fresh-ocaml
    You also should call the following, to build ocamlopt.
    make world; make opt; make install
  • I had the following error. We should set permission 777 of images/tmp [2].
    Error : Failed to parse (Can't write to or create math output directory)
  • I didn't have dvips and convert, so I installed dvipng instead and modified math/render.ml code. The modified code is represented below.
  • And now it works! (\dots p, s) \Downarrow (p,s)
let cmd_dvips tmpprefix = "dvips -R -E " ^ tmpprefix ^ ".dvi -f >" ^ tmpprefix ^ ".ps"
let cmd_latex tmpprefix = "latex " ^ tmpprefix ^ ".tex >/dev/null"
let cmd_convert tmpprefix finalpath = "convert -quality 100 -density 120 " ^ tmpprefix ^ ".ps " ^ finalpath ^ " >/dev/null 2>/dev/null"
let cmd_dvipng tmpprefix finalpath = "/free/home/bluebrown/local/bin/dvipng -quality 100 -density 120 -T tight " ^ tmpprefix ^ ".dvi -o " ^ finalpath ^ " >/dev/null 2>/dev/null"
 
exception ExternalCommandFailure of string
 
let render tmppath finalpath outtex md5 =
let tmpprefix0 = (string_of_int (Unix.getpid ()))^"_"^md5 in
let tmpprefix = (tmppath^"/"^tmpprefix0) in
let unlink_all () =
begin
(* Commenting this block out will aid in debugging *)
Sys.remove (tmpprefix ^ ".dvi");
Sys.remove (tmpprefix ^ ".aux");
Sys.remove (tmpprefix ^ ".log");
Sys.remove (tmpprefix ^ ".tex");
Sys.remove (tmpprefix ^ ".ps");
end in
let f = (Util.open_out_unless_exists (tmpprefix ^ ".tex")) in
begin
output_string f (Texutil.get_preface ());
output_string f outtex;
output_string f (Texutil.get_footer ());
close_out f;
if Util.run_in_other_directory tmppath (cmd_latex tmpprefix0) != 0
then (unlink_all (); raise (ExternalCommandFailure "latex"))
else if (Sys.command (cmd_dvipng tmpprefix (finalpath^"/"^md5^".png")) != 0)
then (unlink_all (); raise (ExternalCommandFailure "dvipng"))
else unlink_all ()
end

Installing Footnote Extension

  • You can find a guide about Cite/Cite.php extension on Mediawiki page [3].

Installing Syntax Highlight Extension

This is a nice extension to present formatted source code, which is called GeSHiCodeTag [4]. Actually, there are many extensions using GeShi[5], but most of them supports only higher version than mine. When you are using php4 and hense using Mediawiki version less than 1.7, you should pick this. To use this package, you also have to download GeSHi, too. Put both of them in the extension file. Oh, and you should put the following tag after $wgSiteName. When I put it next to require_once lists, it didn't work.

## GeSHiCodeTag extension
include("extensions/GeshiCodeTag.php");

Access Control

This is a tricky one. It's pretty easy to restrict editing from an anonymous user[6], but it's hard to restrict viewing particular pages from an anonymous user. Actually, there is a nice extension called Oversight[7], but it only supports Mediawiki version 10 or higher. But I found some hack, using userCan hook (Note that this is only available version 6 or higher). Although you have to modify LocalSettings.php everytime you want to change the restriction, it works. pretty well.[8]

function user_restriction($title, $user, $action, $result) {
if ($action == 'read') {
if (!$user->isLoggedIn() && $title->getText() == 'Hierarchical Motion Controller') {
$result = false;
}
}
}
 
$wgHooks['userCan'][] = 'user_restriction';

References

  1. ipbwiki.com, Error : specified key was too long
  2. Wikimedia, Troubleshooting math display errors
  3. Mediawiki, Extension:Cite/Cite.php
  4. Mediawiki, Extension:GeSHiCodeTag
  5. qbnz.com GeSHi - Generic Syntax Highlighter
  6. Mediawiki, Preventing Access
  7. Mediawiki, Extension:Oversight
  8. Mediawiki, Usercan Hook
.
Powered by MediaWiki. Designed by BlueBrown.