[Rt-commit] rt branch 4.4/convert-to-graphviz2 created. rt-4.4.6-33-ga7707320b0
BPS Git Server
git at git.bestpractical.com
Fri Aug 19 20:57:37 UTC 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 4.4/convert-to-graphviz2 has been created
at a7707320b0fe46e407a6ff722b97cb4c065a073c (commit)
- Log -----------------------------------------------------------------
commit a7707320b0fe46e407a6ff722b97cb4c065a073c
Author: Brian Conry <bconry at bestpractical.com>
Date: Fri Aug 19 15:48:55 2022 -0500
Convert RT to use GraphViz2
The GraphViz module has been delisted, making it unavailable for new
installs.
The GraphViz2 module does not present an identical API, so several
changes needed to be made.
As part of this update the graphs on /Ticket/Graphs/index.html are now
displayed as SVG with links instead of as PNG with a client-side
imagemap.
The PNG images are still available via the same paths as before this
change.
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index b6c4dd0e5b..3335bde437 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -728,7 +728,7 @@ our %META;
my $self = shift;
my $value = shift;
return if $value;
- return if GraphViz->require;
+ return if GraphViz2->require;
$RT::Logger->debug("You've enabled GraphViz, but we couldn't load the module: $@");
$self->Set( DisableGraphViz => 1 );
},
diff --git a/lib/RT/Graph/Tickets.pm b/lib/RT/Graph/Tickets.pm
index 2fd2cda3d0..a2046d1cae 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -58,8 +58,8 @@ RT::Graph::Tickets - view relations between tickets as graphs
=cut
unless ($RT::DisableGraphViz) {
- require GraphViz;
- GraphViz->import;
+ require GraphViz2;
+ GraphViz2->import;
}
our %ticket_status_style = (
@@ -282,7 +282,8 @@ sub AddTicket {
}
}
- $args{'Graph'}->add_node( $args{'Ticket'}->id, %node_style );
+ #{ local $Data::Dumper::Indent=1; $RT::Logger->error(Data::Dumper::Dumper(\%node_style)); }
+ $args{'Graph'}->add_node( name => $args{'Ticket'}->id, %node_style );
}
sub TicketLinks {
@@ -313,7 +314,7 @@ sub TicketLinks {
$args{LeadingLink} = 'Members' unless $valid_links{ $args{LeadingLink} };
unless ( $args{'Graph'} ) {
- $args{'Graph'} = GraphViz->new(
+ $args{'Graph'} = GraphViz2->new(
name => 'ticket_links_'. $args{'Ticket'}->id,
bgcolor => "transparent",
# TODO: patch GraphViz to support all posible RDs
@@ -367,8 +368,8 @@ sub TicketLinks {
$args{'Graph'}->add_edge(
# we revers order of member links to get better layout
$link->Type eq 'MemberOf'
- ? ($target->id => $base->id, dir => 'back')
- : ($base->id => $target->id),
+ ? (from => $target->id, to => $base->id, dir => 'back')
+ : (from => $base->id, to => $target->id),
%{ $link_style{ $link->Type } || {} },
$desc? (label => gv_escape $desc): (),
);
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 941af7834d..e3e02c9708 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -279,7 +279,7 @@ String::ShellQuote
.
$deps{'GRAPHVIZ'} = [ text_to_hash( << '.') ];
-GraphViz
+GraphViz2
IPC::Run 0.90
.
diff --git a/share/html/Ticket/Graphs/Elements/ShowGraph b/share/html/Ticket/Graphs/Elements/ShowGraph
index 16bee5c350..a56ba47642 100644
--- a/share/html/Ticket/Graphs/Elements/ShowGraph
+++ b/share/html/Ticket/Graphs/Elements/ShowGraph
@@ -45,8 +45,13 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<div><img src="<% RT->Config->Get('WebPath') %>/Ticket/Graphs/<% $id %>?<% $m->comp('/Elements/QueryString', %ARGS) %>" usemap="#<% $graph->{'NAME'} || 'test' %>" style="border: none" />
-<% safe_run_child { Encode::decode( "UTF-8", $graph->as_cmapx ) } |n %>
+%#<div><img src="<% RT->Config->Get('WebPath') %>/Ticket/Graphs/<% $id %>?<% $m->comp('/Elements/QueryString', %ARGS) %>" usemap="#<% $graph->{'NAME'} || 'test' %>" style="border: none" />
+% safe_run_child {
+% $graph->run(
+% im_format => 'cmapx',
+% );
+% };
+<% Encode::decode( "UTF-8", $graph->dot_output ) |n %>
</div>
<& ShowLegends, %ARGS, Ticket => $ticket &>
<%ARGS>
diff --git a/share/html/Ticket/Graphs/dhandler b/share/html/Ticket/Graphs/dhandler
index a1f45a4cdd..3a294050f5 100644
--- a/share/html/Ticket/Graphs/dhandler
+++ b/share/html/Ticket/Graphs/dhandler
@@ -74,8 +74,8 @@ $m->clear_buffer;
my $png;
use RT::Util 'safe_run_child';
-safe_run_child { $graph->as_png(\$png) };
-$m->out( $png );
+safe_run_child { $graph->run(format => 'png') };
+$m->out( $graph->dot_output );
$m->abort;
diff --git a/t/security/CVE-2011-5092-graph-links.t b/t/security/CVE-2011-5092-graph-links.t
index c32ad90ba0..085e148b5e 100644
--- a/t/security/CVE-2011-5092-graph-links.t
+++ b/t/security/CVE-2011-5092-graph-links.t
@@ -4,7 +4,7 @@ use warnings;
use RT::Test tests => undef;
plan skip_all => 'GraphViz required.'
- unless GraphViz->require;
+ unless GraphViz2->require;
my ($base, $m) = RT::Test->started_ok;
$m->login;
@@ -23,7 +23,7 @@ for my $arg (qw(LeadingLink ShowLinks)) {
ok !$ticket->ToldObj->IsSet, 'still no Told';
$m->content_lacks('GotoFirstItem', 'no GotoFirstItem error');
- $m->content_like(qr|<img[^>]+?src=['"]/Ticket/Graphs/@{[$ticket->id]}|, 'found image element');
+ $m->content_like(qr|<svg.+?<a xlink:href=['"]/Ticket/Display\.html\?id=@{[$ticket->id]}|s, 'found image element');
}
done_testing;
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list