미디어위키

지각생 연습장

목차

사용

업그레이드

  • 백업 : DB, 파일들
  • 새 버전 받아 압축 풀기
  • AdminSettings.php 생성 (AdminSettings.sample 파일 이용)
  • 업데이트
    1. $ php maintenance/update.php (쉘에서)
    2. 혹은 installer 사용 재설치 (LocalSettings.php 재생성)

스팸 방지

extension

관리 도구

Semantic Mediawiki

  • SMW
  • Semantic Form
  • Semantic Drilldown

anti-spam extensions

사용자 생성 제한

  • mediawiki 사용자 생성 막기 / 금지하기
    • 가입할 사람만 가입시키고 가입을 막아 버린다던가, (그룹 퍼미션에서 createaacount를 끔)
    • 아니면 가입승인 기능을 추가 (ConfirmAccount 확장 추가)
  • ConfirmAccount 확장기능은 biography 에서 한국어 단어 수를 제대로 세지 못한다. RequestAccount_body.php 파일을 아래와 같이 수정
    • 290번째 줄 부근에서 아래와 같은 줄을 찾아
      if ( str_word_count( $this->mBio ) < $wgAccountRequestMinWords ) {
    • 이렇게 고쳐준다.
$wordcount = count(preg_split('~[^\p{L}\p{N}\']+~u',$this->mBio));
if ( $wordcount < $wgAccountRequestMinWords ) {

Captcha: ConfirmEdit

  • ConfirmEdit - 작성시 captcha 확인 (스팸 방지)
    • 1.6 이상 버전에서 작동. 최신 버전은 PHP5 필요, PHP4의 경우는 21970 이전의 revision을 다운받음(svn 명령어 사용)
    • 일반적 설치
    1. ConfirmEdit.php 와 ConfirmEdit.i18n.php 두 파일을 다운로드
    2. 위키 설치 디렉토리/extensions 아래 ConfirmEdit 디렉토리 만듬
    3. 다운받은 두 파일을 위에 만든 디렉토리에 업로드
    4. 위키의 LocalSettings.php 를 열어 다음 한 줄 포함
      require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" );
    5. 위의 파일(ConfirmEdit.php)을 열어 아래줄처럼 변경 (원래는 false)
      $wgCaptchaTriggers['edit'] = true;
      $wgCaptchaTriggers['create'] = true;
    6. 로그인한 모든 사용자에겐 안 물어보려면
      $wgGroupPermissions['user']['skipcaptcha'] = true;
    • php4 에서 설치 (옛날 버전으로 설치)
      1. svn checkout --revision 21970 http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ConfirmEdit/
      2. 이후 위와 같은 방법으로 설정
      • 빈집 홈페이지에 설치 (09/1/12), 메시지 파일(ConfirmEdit.i18n.php)에 한글이 없어서 $wgConfirmEditMessage['ko'] 변수에 최신 버전의 메시지 내용을 넣어줬다.

멀티미디어

  • VPIPPlugin : vPIP 를 미디어위키에서 쓸 수 있게 하는 것. 좋다.
    • 플러그인과 vPIP 다운로드하고,
    • 플러그인의 vPIP.php 를 수정해서 PlayButton.gif 와 DownloadButton.gif 의 경로를 수정한다.
    • vPIP를 위한 코드를 미디어위키 스킨 </head> 바로 앞에 넣고
    • <script src="http://[url where vPIP was uploaded to]/vpip.js" type="text/javascript"></script><style type="text/css" media="all">@import "http://[url where vPIP was uploaded to]/vPIPBox.css";</style><script src="http://[url where vPIP was uploaded to]/jquery.js" type="text/javascript"></script><script src="http://[url where vPIP was uploaded to]/vpipit.js" type="text/javascript"></script>
    • 일반적 방법으로 플러그인(확장기능)을 활성화한다.


  • 사용법은 <video>~</video> 태그 안에 url, image, width, caption 등의 인수를 지정해서 쓴다.

<video> caption=test image=http://kuchu-camp.net/images/way_to_camp.jpg url=http://kuchu-camp.net/movie/way_to_camp.wmv </video>

  • EmbedVideo - embedding video clips from popular video sharing services
    • 미문동 위키에서 사용중 (2007/10)
    • 설치방법은 같음 - extensions/ 아래에 파일 업로드. LocalSettings.php 에서 require_once 로 불러옴
    • 사용법
      • {{#ev:service|id}} -or-
      • {{#ev:service|id|width}}
  • http://www.mediawiki.org/wiki/Extension:VideoFlash
  • FlashMP3 embeds a simple Flash-player for playback of mp3-files. It is based on the great Audio Player Wordpress plugin by 1pixelout.
  • Embdedded Video 확장기능. 알기 쉽게 임베드 시킬 수 있을 것 같긴 한데 아직 뭔가가 잘 안된다. 이미지도 잘 안뜨고. vPIP 를 쓰는 다른 방법 혹은 뭔가 해야할 작업이 있는건가. 어쨌든 이런 류의 확장기능을 더 자세히 살펴봐야겠다. 그리고 제길 이 페이지좀 정리하자 -_-
  • EmbedURL
    1. <embedurl>http://www.my-url.com/</embedurl>
    2. <embedurl>http://www.my-url.com/{width=640}{height=480}</embedurl>


Some fun extensions

FCKeditor

  • 확장기능 : http://mediawiki.fckeditor.net/
  • FCKeditor : http://www.fckeditor.net/
  • 설치 방법
    1. 위 주소에서 FCKeditor 확장기능을 다운로드한다.
    2. extensions 디렉토리 아래에 둔다
    3. FCKeditor 를 다운받는다. (확장기능 말고 에디터 자체)
    4. 다운받은 FCKeditor 를 "FCKeditor 확장기능" 디렉토리 아래에 있는 fckeditor 디렉토리에 압축을 푼다
    5. LocalSettings.php에 다음 한줄을 추가해 활성화 한다. 끝이다 :)
      require_once("$IP/extensions/FCKeditor/FCKeditor.php");
  • 참고 : clean 스킨과 충돌함

inputbox : 간단한 입력 폼 만들기

<inputbox> type=create width=15 default=테스트 break=no </inputbox>

기타 (미확인)

관리

  • 파일 업로드 확장자 설정 : LocalSettings.php 파일에 아래 줄 찾아 고침(없음 추가)
$wgFileExtensions = array('ppt', 'doc', 'pdf', 'jpg', 'odt' ...);
  • 계정 암호 바꾸기
    UPDATE user SET user_password = MD5(CONCAT(user_id, '-', MD5('somepass'))) WHERE user_name = 'someuser';
    • Where obviously "somepass" is changed to the password you want to set and "someuser" is changed to the user name as it is listed in the table "user".
    • Note: The user_id in the CONCAT string is a column name and is not meant to be replaced with 'someuser'
    • Note: If you obtain a 'dbname.user table does not exist' error, please check the LocalSettings.php file, and double-check the value for the $wgDBprefix variable. If that variable is not empty, try repeating the command, replacing $wgDBPrefix_user instead of user in the UPDATE clause of the SQL statement.

참고

좋은 참고, 자료 사이트들

해킹

확장기능 만들어보는 중. 참가신청폼을 만들려고 inputbox 를 본따고 있다

  • 이름 *
  • 소속
  • 연락처 *
  • 이메일 *
  • 관심/활동분야
  • 하고싶은 말

스킨

  • Chick
  • CologneBlue
  • MonoBook
  • MySkin
  • Nostalgia
  • Simple
  • Standard

clean

08년 7월부터 쓰기 시작한 clean 스킨관련 팁

  • 링크걸린 이미지 주위의 파란 테두리 없애기 : skins/clean/main.css 파일을 열어 다음 줄 추가
    a img { border: none }
  • 왼쪽 위 "wiki"메뉴에 최근바뀜 표시하기
    • 위키 디렉토리의 includes/SkinTemplate.php 에서 이런 줄을 찾아
       $nav_urls['specialpages'] = array( 'href' => self::makeSpecialUrl( 'Specialpages' ) );
    • 아래 내용을 추가해준다. (복사해서 붙인 후 수정)
        $nav_urls['recentchanges'] = array( 'href' => self::makeSpecialUrl( 'RecentChanges' ) );
      
  • 참고: clean 스킨은 FCKeditor 확장기능과 충돌한다.

The MediaWiki codebase

The MediaWiki codebase is large and ugly. Don't be overwhelmed by it. When you're first starting off, aim to write features or fix bugs which are constrained to a small region of code.

You can browse the generated documentation.

One of the best ways to learn about MediaWiki is to read the code. Here are some starting points:

  • index.php is the main entry point, although where things go from there is not very obvious.
  • Article.php contains code for page view, delete, rollback, watch and unwatch. It also contains some general utilities for dealing with articles, such as fetching a revision or saving a page.
  • EditPage.php has about half of the code related to editing, the half that's close to the user interface. The rest is in Article.php and the various *Update.php files.
  • Parser.php has most of the code that converts wikitext to HTML. A few bits and pieces are in Skin.php
  • Linker.php has functions to generate the HTML for links and images
  • Code for most special pages is in the Special*.php files.
  • Database.php contains stacks of functions for accessing the database.
  • OutputPage.php is the home of the OutputPage class, which is an output buffer. Send your text here and it will be sent to stdout just before the script exits.
  • Title.php is all about titles -- and that includes interwiki titles and "#" fragments. There's some functions in here that will fetch information about an article from the database.
  • User.php contains the User class, which represents user preferences and permissions.
  • Setup.php does all sorts of initialisation, and seems to account for a large proportion of running time. Among other things, it initialises lots of global variables, mostly containing objects.
  • DefaultSettings.php contains defaults for lots of global variables, which may or may not be overridden in LocalSettings.php. Don't use isset(), always add a default for any global variable you introduce.

For getting started with debugging, see How to debug MediaWiki.

개인 도구