Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl 如何在现有的bugzilla代码中使用bugzilla API?_Perl_Bugzilla - Fatal编程技术网

Perl 如何在现有的bugzilla代码中使用bugzilla API?

Perl 如何在现有的bugzilla代码中使用bugzilla API?,perl,bugzilla,Perl,Bugzilla,嗯,目前我有两个目标 用户在bugzilla中没有编辑bug的权限,但他/她应该写/发布关于该bug的评论。我认为这可以通过下面的API实现,但我不确定,因为我是bugzilla和Perl的新手。 我想使用importxml.pl导入bug,但我不想在DB中添加新条目。我只想在包含bug信息的bug.xml文件的基础上,修改bugzilla现有bug的一些字段 i、 e.perl-tc:\bugzilla\bugzilla\importxml.pl-vc:\bugzilla\bugzilla\m

嗯,目前我有两个目标

用户在bugzilla中没有编辑bug的权限,但他/她应该写/发布关于该bug的评论。我认为这可以通过下面的API实现,但我不确定,因为我是bugzilla和Perl的新手。 我想使用importxml.pl导入bug,但我不想在DB中添加新条目。我只想在包含bug信息的bug.xml文件的基础上,修改bugzilla现有bug的一些字段

i、 e.perl-tc:\bugzilla\bugzilla\importxml.pl-vc:\bugzilla\bugzilla\mybugs\bug.xml

也许下面的API会有帮助,但我不确定

那么,实现这些目标的可能途径是什么

正如我所想,也许我应该将这些API的方法应用到现有的bugzilla代码中,我的梦想是:

将为没有bug编辑权限的用户启用注释。 我将通过传递一些参数从命令行运行importxml.pl脚本,并修改现有bug的一些字段。
但我不确定,我的想法是对的还是错的。我也不知道如何使用这些API的方法???

email_in.pl脚本可以完成您要求的类型。但是,您需要创建一个有权进行更改的用户,并且需要将数据转换为email_in.pl能够理解的格式


关于第一点,我可以提供帮助:

下面是我修改的一个svn_bz_append.pl脚本的摘录,我用它来更新关于svn提交的bugzilla注释。请注意,我将此脚本与Bugzilla安装在同一台机器上运行,因为它使用Bugzilla目录中的模块。我为Bugzilla V4.2.3工作

我省略了这段脚本中的很多内容,以引出下面的摘录:

use strict;
use warnings;

use Bugzilla;
use Bugzilla::Config;
use Bugzilla::Bug;

use Data::Dumper;
。。。创建/获取要处理的用户ID和一些bug ID

例如:

。。。现在循环浏览bug ID并添加注释

foreach my $bugId (@bugs) {

my $user = new Bugzilla::User({ id => $userid}) 
 || ThrowUserError('invalid_username', { id => $userid}); #get the user from bugzilla
print STDERR 'user: '. Dumper($user); #pretty prints the user object

Bugzilla->set_user($user); #this authenticates the user so that you may perform actions on bugs that the user has permissions to.

my $bug = Bugzilla::Bug->check($bugId); #gets the bug
print STDERR 'bug: '. Dumper($bug); #pretty prints the bug object

$bug->add_comment($message); #adds a comment to the bug
$bug->update(); #updated the bug - don't forget to do this!
}

请注意,转储程序函数只是使用优秀的Data::Dumper模块:-除了调试之外,您不需要它们

登录信息来自:

foreach my $bugId (@bugs) {

my $user = new Bugzilla::User({ id => $userid}) 
 || ThrowUserError('invalid_username', { id => $userid}); #get the user from bugzilla
print STDERR 'user: '. Dumper($user); #pretty prints the user object

Bugzilla->set_user($user); #this authenticates the user so that you may perform actions on bugs that the user has permissions to.

my $bug = Bugzilla::Bug->check($bugId); #gets the bug
print STDERR 'bug: '. Dumper($bug); #pretty prints the bug object

$bug->add_comment($message); #adds a comment to the bug
$bug->update(); #updated the bug - don't forget to do this!