Fork me on GitHub

mantis的学习

Mantis

简介

基本概述

缺陷管理平台Mantis,也叫做MantisBT,全称Mantis Bug Tracker。它是一个基于PHP技术的轻量级的开源缺陷跟踪系统,以web操作的形式提供项目管理以及缺陷跟踪服务。所谓缺陷跟踪系统,它主要完成对缺陷报告的记录、分析和状态更新管理。

基本功能

(1)个人可定制的Email通知功能,每个用户可根据自身的工作特点只订阅相关缺陷状态邮件;
(2)支持多项目、多语言;
(3)权限设置灵活,不同角色有不同权限,每个项目可设为公开或私有状态,每个缺陷可设为公开或私有状态,每个缺陷可以在不同项目间移动;
(4)主页可发布项目相关新闻,方便信息传播;
(5)具有方便的缺陷关联功能,除重复缺陷外,每个缺陷都可以链接到其他相关缺陷;
(6)缺陷报告可打印或输出为CSV格式,1.1.7版:支持可定制的报表输出,可定制用户输入域;
(7)有各种缺陷趋势图和柱状图,为项目状态分析提供依据,如果不能满足要求,可以把数据输出到Excel中进一步分析;
(8)流程定制方便且符合标准,满足一般的缺陷跟踪。

安装配置

Windows环境下Xampp+mantis

安装步骤

  1. 将下载好的mantis解压放在D:\xampp\htdocs文件夹下
    在浏览器中输入
    http://localhost/mantis/

    http://localhost:800/mantis (xampp的Apache修改了端口号)
  2. 点击 Install/Upgrade Database
    文本框中默认信息不动
    在“Password (for Database)”输入刚修改的ROOT密码。
    “Admin Username (to create Database if required)”输入root,
    “Admin Password (to create Database if required)”输入ROOT密码,如123456。
    点击“Install/Upgrade Database”进行安装。
    安装完成后,右侧标签全为绿色GOOD。
  3. 再次在地址栏中输入http://localhost/mantis(或http://localhost:800/mantis xampp的Apache端口修改了) 进入Mantis登录页面。
    初始用户名为“administrator”,密码为“root”, Mantis安装完成。安装完成后要删除mantis目录下的admin文件夹!
  4. 汉化
    打开安装目录\xampp\htdocs\mantis\config_defaults_inc.php文件,
    修改$g_default_language = ‘english’; 为$g_default_language = ‘chinese_simplified’;
  5. 时间设置
    使用个人账户登录系统后,可在【个人资料】->【更改个人设置】,在“时区”选项中选择”shanghai”。此种方法需要每个账户自行修改。

注意:

新建账户时无法设置账户登录密码。
在Mantis目录下config_defaults_inc.php文件中找到$g_send_reset_password,然后设置:$g_send_reset_password =OFF 即可。
重新使用administrator账号及密码,登录mantis, 依次选择 管理 -> 用户管理 -> “创建用户”, 即可看到填写密码的输入框。

可能的错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
安装时出现错误
Schema CreateTableSQL ( mantis_config_table )

BAD
CREATE TABLE mantis_config_table ( config_id VARCHAR(64) NOT NULL, project_id INTEGER NOT NULL DEFAULT 0, user_id INTEGER NOT NULL DEFAULT 0, access_reqd INTEGER DEFAULT 0, type INTEGER DEFAULT 90, value LONGTEXT NOT NULL, PRIMARY KEY (config_id, project_id, user_id) )ENGINE=MyISAM DEFAULT CHARSET=utf8
Table 'mantis_config_table' already exist
登录时出现错误
APPLICATION ERROR #401
Database query failed. Error received from database was #1054: Unknown column 'priority' in 'field list' for the query: SELECT basename, priority, protected FROM mantis_plugin_table WHERE enabled=? ORDER BY priority DESC.

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
分析解决:
数据库中有相关的表,可能重复点击进入了(login_page.php和install.php)
1.进入mysql中清理干净相关的表再装。2.删除mantis包重新复制进去安装。

linux环境下安装(Apache+mantis)

准备工作:

可以现在windows下下载好mantis的tar压缩包,然后通过远程传输到linux服务器上。
或直接在服务器上下载:

1
wget http://sourceforge.net/projects/mantisbt/files/mantis-stable/1.2.15/mantisbt-1.2.15.tar.gz/download

在linux上进入到放mantis压缩包的目录:

1
tar -xvf mantisbt-1.2.15-tar

将解压完的文件夹改名为mantis,并将其移到apache下:

1
mv mantisbt-1.2.15 /var/www/html/mantis

对mantis文件夹进行赋权限,然后进入该文件夹下:

1
2
chmod 777 /var/www/html/mantis
cd /var/www/html/mantis

复制出mantis配置文件:

1
cp config_inc.php.sample config_inc.php

开始安装

打开网址安装mantis自动生成数据库:

1
http://ip/mantis/admin/install.php//输入框按实际的填

配置参数

修改mantis配置文件(配置数据库参数):

1
2
3
4
5
6
7
vim config_inc.php
//修改以下参数(主机名、用户名、密码、数据库名、数据库种类)
$g_hostname = 'localhost';
$g_db_username = 'mantisdbuser';
$g_db_password = '';
$g_database_name = 'bugtracker';
$g_db_type = 'mysql';

删除mantis下的admin文件夹

1
rm -rf admin/

修改语言:

1
2
vim config_defaults_inc.php
$g_default_language = 'english'; 为$g_default_language = 'chinese_simplified';

网址栏打开mentis会有如下警告

1
You should disable the default 'administrator' account or change its password.

此时默认的登录用户是administrator,密码是root,登录上去将密码修改即可,再无此警告。

可能出现的警告处理

php版本不一致

1
SYSTEM WARNING: 'mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50556 Library:50637' in '/var/www/html/mantis/library/adodb/drivers/adodb-mysqli.inc.php' line 110

在服务器上执行以下命令查看mysql相关版本:

1
2
3
4
5
6
php -i | grep Client
Client API version => 5.6.38
Client API library version => 5.6.38
Client API header version => 5.5.56-MariaDB
Client API version => 5.6.38
Soap Client => enabled

可以发现版本不一致…
解决方法:

1
2
yum remove -y php-mysql
yum install -y php-mysqlnd

将php里支持的php-mysql换成了php-mysqlnd
再次查看:

1
2
3
4
5
php -i | grep Client
Client API version => mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
Client API library version => mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
Client API version => mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
Soap Client => enabled

可以发现此时版本一致了…
最后记得要重启服务:

1
2
systemctl restart httpd
systemctl restart mysqld

php的date未修改

1
SYSTEM WARNING: 'date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in '/var/www/html/mantis/core.php' line 254

解决方法:

1
2
3
4
5
vim /etc/php.ini
//找到#date.timezone =修改如下:
date.timezone ="Asia/Shanghai"
//最后记得重启服务
systemctl restart httpd

-------------本文结束感谢您的阅读-------------
如果您对博主的原创满意,欢迎您继续支持下博主~