"미디어위키 Scribunto 설치"의 두 판 사이의 차이

60번째 줄: 60번째 줄:
$wgScribuntoUseGeSHi = true;
$wgScribuntoUseGeSHi = true;
</source>
</source>
:→ 만약 [[미디어위키 확장기능 SyntaxHighlight GeSHi]]가 설치되어 있지 않다면 맨 아래 줄은 주석처리;;<ref>아마 왠만하면 설치되어 있을 것이다...</ref>
:→ 만약 [[미디어위키 확장기능 SyntaxHighlight GeSHi]]가 설치되어 있지 않다면 맨 아래 줄은 빼자.<ref>아마 왠만하면 설치되어 있을 것이다...</ref>


==확인==
==확인==

2014년 8월 10일 (일) 22:58 판

1 개요

미디어위키 Scribunto 설치
미디어위키 확장기능 Scribunto 설치
  • 모듈:XXXX 형식으로 Lua 언어를 사용가능하도록 하는 미디어위키 확장기능
  • 1) Lua를 설치해도 되고, 2) LuaSandbox를 설치해도 된다.[1]
여기서는 Lua를 설치하는 방법으로 할 것이다.[2]

2 요구조건 확인

2.1 미디어위키 1.20 이상

  • 자신의 미디어위키 웹사이트에서 Special:Version 가기
  • 미디어위키 버전이 1.20 이상인 확인

2.2 PCRE 8.10 이상

[root@jmnote ~]# php -i | grep PCRE
PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 8.32 2012-11-30
→ PCRE의 버전이 8.32이므로 OK

2.3 Lua 버전 5.1 이상

[root@jmnote ~]# lua -v
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
→ Lua 버전이 5.1.4이므로 OK

2.4 Lua 퍼미션 확인

[root@jmnote ~]# which lua
/usr/bin/lua
[root@jmnote ~]# ll /usr/bin/lua
-rwxr-xr-x 1 root root 12552 Oct  7  2010 /usr/bin/lua
→ 모든 리눅스계정에 대해 실행가능. OK

3 Scribunto 설치

[root@jmnote w]# cd extensions/
[root@jmnote extensions]# git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
Cloning into 'Scribunto'...
remote: Counting objects: 700, done
remote: Finding sources: 100% (498/498)
remote: Getting sizes: 100% (183/183)
remote: Compressing objects: 100% (421212/421212)
remote: Total 3582 (delta 230), reused 3466 (delta 225)
Receiving objects: 100% (3582/3582), 2.56 MiB | 641 KiB/s, done.
Resolving deltas: 100% (1864/1864), done.

4 미디어위키 설정 변경

require_once "$IP/extensions/Scribunto/Scribunto.php";
$wgScribuntoDefaultEngine = 'luastandalone';
$wgScribuntoUseGeSHi = true;
→ 만약 미디어위키 확장기능 SyntaxHighlight GeSHi가 설치되어 있지 않다면 맨 아래 줄은 빼자.[3]

5 확인

  • 자신의 미디어위키 웹사이트에서 Special:Version 가기
  • "설치된 확장 기능" 목록 중 Scribunto 있는지 확인

6 테스트

-- 헬로 월드!
local p = {}
 
function p.hello()
    return "Hello, world!"
end
 
return p

7 주석

  1. Lua는 리눅스 쉘에서 직접 실행되는 방식이고 LuaSandbox는 PHP 확장기능으로서 실행되는 방식이다.
  2. LuaSandbox가 더 빠르다고는 하는데, 어차피 Lua는 문서 저장시에만 실행되므로 별로 부담되는 것은 아니다. 즉, 미디어위키 문서로 저장되고 나면, 읽을 때는 Lua가 구동되지 않는다. 또한 LuaSandbox는 컴파일 설치가 필요하다...
  3. 아마 왠만하면 설치되어 있을 것이다...

8 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}