1 개요[ | ]
- 미디어위키 훅 - 특정 네임스페이스 문서 변경 이벤트 처리
- 변경(Creation, Update, Delete) 이벤트 처리
PHP
Copy
# 3000번 네임스페이스 문서 저장 (생성 또는 편집 완료)
$wgHooks['PageContentSaveComplete'][] = function($wikiPage, $user, $content, $summary, $isMinor, $isWatch, $section, $flags, $revision, $status, $originalRevId, $undidRevId) {
if( $wikiPage->getTitle()->getNamespace() != 3000 ) return;
// $wikiPage라는 문서가 저장되었다...
};
# 3000번 네임스페이스 문서 삭제
$wgHooks['ArticleDelete'][] = function( WikiPage &$article, User &$user, &$reason, &$error ) {
if( $error ) return;
if( $article->getTitle()->getNamespace() != 3000 ) return;
$page_id = $article->getId();
// $page_id 번 문서가 삭제되었다...
};
# 3000번 네임스페이스 문서 복원
$wgHooks['ArticleUndelete'][] = function( Title $title, $create, $comment, $oldPageId, $restoredPages ) {
if( $title->getNamespace() != 3000 ) return;
$page_id = $title->getArticleId();
// $page_id 번 문서가 복원되었다...
};
2 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.