rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml">
目的构建一个平时管理项目服务器,对代码进行源码管理,bug跟踪、文档管理、wiki等功能。
使用软件如下:
xampp 1.6.7 +mantis1.1.2+dokuwiki+SVN1.6
下面简述一下安装过程:
1 安装xampp 1.6.7
许多人通过他们自己的经验认识到安装 Apache 服务器是件不容易的事儿。如果您想添加 MySQL、PHP 和 Perl,那就更难了。XAMPP 是一个易于安装且包含 MySQL、PHP 和 Perl 的 Apache 发行版。XAMPP 的确非常容易安装和使用:只需下载,解压缩,启动即可。
xampp的安装非常简单,解压至指定目录即可,不过xampp文件夹最好在硬盘分区的根目录下。为了方便以后使用tomcat服务,这里将xampp的tomcat插件也一并装上。将xampp-win32-tomcat-addon- 6.0.14 -2.2.9解压至xampp文件夹下,覆盖当前文件夹中的文件。
由于tomcat需要使用JDK,这里我们下载jdk开发包,并安装。同时指定系统变量"JAVA_HOME",对应刚才安装的jdk目录。。
一切工作就序后,执行xampp目录下的setup_xampp.bat。即可完成安装。
安装结束后在浏览器中输入地址http://localhost/xampp。 选择进入中文界面即可。
2 安装mantis 1.1.2
将下载的mantis解压至xampp文件夹中的htdocs目录下(如C:/xampp/htdocs)。
在浏览器中输入地址http://localhost/mantis 进行mantis的安装。有几问题需要注意。
1、正确的输入mysql数据库的用户和密码。
2、最好先在mysql中建好所需要的数据库名称。
3、安装时导入mysql数据库时,要选用utf8编码,否则后期还得改。
3 安装dokuwiki(实际上这里有两步,一是安装dokuwiki程序,二是整合dokuwiki和mantis)
△正确安装dokuwiki将下载的mantis解压至xampp文件夹中的htdocs目录下(如C:/xampp/htdocs)。
#所以在安裝路徑網址下 install.php (Exp. http://192.168.11.236/dokuwiki/install.php)
#右上角將語系改成 zh
#左邊欄位就開始一一輸入
(1)Wiki Name : MyWiki
(2)依據將所有的欄位填好
(3)我是設定預設的 ACL 是屬於 Closed Wiki
(4)點下[儲存]
#將 install.php 刪除掉 .. 實際命令語法
△建立 mantis 認證程式碼 /var/www/html/dokuwiki/inc/auth/mantis.class.php
△建立 mantis 認證程式碼 修改mantis.class.php 文件。(这里请注意指定mantis路径正确性)
<?php
/* for intergrating with Mantis */
define( 'MANTIS_ROOT', 'C:/xampp/htdocs/mantis/' );
define( 'MANTIS_URL', 'http://localhost/mantis/' );
/**
* Mantis auth backend
*
* Uses external Trust mechanism to check against Mantis'
* user cookie.
*
* @author Victor Boctor (http://www.futureware.biz)
*/
require_once( MANTIS_ROOT . 'core.php' );
class auth_mantis extends auth_basic {
/**
* Constructor.
*
* Sets additional capabilities and config strings
*/
function auth_mantis(){
$this->cando['external'] = true;
}
/**
* Authenticates the user using Mantis APIs.
*/
function trustExternal($user,$pass,$sticky=false){
global $USERINFO;
global $conf;
if ( auth_is_user_authenticated() ) {
// okay we're logged in - set the globals
$USERINFO['pass'] = current_user_get_field( 'password' );
$USERINFO['name'] = current_user_get_field( 'username' );
$USERINFO['mail'] = current_user_get_field( 'email' );
$t_project_name = getNS( getID() );
$t_project_id = project_get_id_by_name( $t_project_name );
$t_access_level = access_get_project_level( $t_project_id );
$t_access_level_string = strtoupper( get_enum_to_string( config_get( 'access_levels_enum_string' ), $t_access_level ) );
$USERINFO['grps'] = array( $t_access_level_string );
$_SERVER['REMOTE_USER'] = $USERINFO['name'];
$_SESSION[$conf['title']]['auth']['user'] = $USERINFO['name'];
$_SESSION[$conf['title']]['auth']['info'] = $USERINFO;
return true;
}
// to be sure
auth_logoff();
return false;
}
/**
* Logout from Mantis
*/
function logOff(){
auth_logout();
}
/**
* Retrieves the user data of the user identified by
* username $user. This is used, e.g., by dokuwiki's
* email notification feature.
*/
function getUserData( $user ) {
$userData = false;
$mantis_uid = user_get_id_by_name( $user );
if ( $mantis_uid ) {
$userData['username'] = user_get_field( $mantis_uid, 'username' );
$userData['mail'] = user_get_field( $mantis_uid, 'email' );
$t_project_name = getNS( getID() );
$t_project_id = project_get_id_by_name( $t_project_name );
$t_access_level = access_get_project_level( $t_project_id , $mantis_uid );
$t_access_level_string = strtoupper( get_enum_to_string( config_get( 'access_levels_enum_string' ), $t_access_level ) );
$userData['grps'] = array( $t_access_level_string );
}
return $userData;
}
}
?>
△修改權限檔 /var/www/html/dokuwiki/conf/acl.auth.php
:
* @ALL 0
* @VIEWER 1
* @REPORTER 2
* @DEVELOPER 8
* @MANAGER 8
* @ADMINISTRATOR 8
△增加 Mantis Syntax Plug-in /var/www/html/dokuwiki/lib/plugins/mantis/syntax.php
<?php
/**
* Mantis Plugin: Hyperlinks references to Mantis Issues
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Victor Boctor (http://www.futureware.biz)
*/
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
/**
* A plug-in that hyper links references to Mantis issues. References
* to Mantis issues should use the following format: ~~Mantis:123~~.
*
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
*/
class syntax_plugin_mantis extends DokuWiki_Syntax_Plugin {
/**
* return some info
*/
function getInfo(){
return array(
'author' => 'Victor Boctor',
'email' => 'vboctor at users . sourceforge . net',
'date' => ' 2006-05-18 ',
'name' => 'Mantis Issues Plugin',
'desc' => 'Support References to Mantis Issues',
'url' => 'http://www.futureware.biz',
);
}
/**
* What kind of syntax are we?
*/
function getType(){
return 'substition'; # typo is intentional
}
/**
* What about paragraphs?
*/
function getPType(){
return 'normal';
}
/**
* Where to sort in?
*/
function getSort(){
return 156;
}
/**
* Connect pattern to lexer
*/
function connectTo($mode) {
$this->Lexer->addSpecialPattern('~~Mantis:[0-9]+~~', $mode, 'plugin_mantis');
}
/**
* Handle the match
*/
function handle($match, $state, $pos, &$handler){
$match = substr( $match, 9, -2 ); // strip "~~Mantis:" from start and "~~" from end
return array( strtolower( $match ) );
}
/**
* Create output
*/
function render($format, &$renderer, $data) {
if ( $format == 'xhtml' ) {
$renderer->externallink( MANTIS_URL . 'view.php?id=' . $data[0], $data[0] );
return true;
}
return false;
}
}
?>
△透過 dokuwiki 原本設定介面來更動 /var/www/html/dokuwiki/conf/local.php
1.Use access control lists → 打勾(應該已經打勾)
2.Authentication backend → mantis(上面的步驟完成才會出現 mantis 選項)
3.Default group → VIEWER
4.Superuser → @ADMINISTRATOR
5.確認 /var/www/html/dokuwiki/conf/local.php 內應該要出現以下的設定值
$conf['useacl'] = 1;
$conf['authtype'] = 'mantis';
$conf['defaultgroup'] = 'VIEWER';
$conf['superuser'] = '@ADMINISTRATOR';