[Rt-commit] rt branch, 3.999-trunk, updated. c871fcf954a944fa4597cbf27bade52c711d8eb7

clkao at bestpractical.com clkao at bestpractical.com
Thu Nov 19 06:29:41 EST 2009


The branch, 3.999-trunk has been updated
       via  c871fcf954a944fa4597cbf27bade52c711d8eb7 (commit)
      from  b3e32a8b2b3883e67188f49635237c5627e74c2f (commit)

Summary of changes:
 Makefile.PL                            |    1 +
 etc/initialdata                        |    1 +
 lib/RT/Config.pod                      |    4 ++++
 lib/RT/Graph/Tickets.pm                |   20 +++++++++++++-------
 share/html/Ticket/Elements/ShowSummary |    3 ++-
 share/html/Ticket/ModifyLinks.html     |    3 ++-
 6 files changed, 23 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit c871fcf954a944fa4597cbf27bade52c711d8eb7
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Thu Nov 19 19:20:05 2009 +0800

    restore disable_graphviz check with kludges.

diff --git a/Makefile.PL b/Makefile.PL
index fdb5c2a..814a1d1 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -31,6 +31,7 @@ requires(
     'File::Temp'                 => '0.18',
     'Text::Quoted'               => '2.02',
     'Tree::Simple'               => '1.04',
+    'Try::Tiny'                  => 0,
     'UNIVERSAL::require'         => 0,
     'Regexp::Common'             => 0,
     'Regexp::Common::Email::Address'             => 0,
diff --git a/etc/initialdata b/etc/initialdata
index e5aceb8..e695133 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -662,6 +662,7 @@ Hour:         { $subscription_obj->sub_value('Hour') }
    '<small>__last_updated_relative__</small>',
    '<small>__time_left__</small>'},
     'default_summary_rows'         => 10,
+    'disable_graphviz'             => undef,
     'dont_search_file_attachments' => undef,
     'drop_long_attachments'        => undef,
     'email_input_encodings'        => [ 'utf-8', 'iso-8859-1', 'us-ascii' ],
diff --git a/lib/RT/Config.pod b/lib/RT/Config.pod
index af94dd8..eec2f63 100644
--- a/lib/RT/Config.pod
+++ b/lib/RT/Config.pod
@@ -709,6 +709,10 @@ results on the frontpage.
 
 default: C<10>
 
+=item C<disable_graphviz>
+
+default: C<undef>
+
 =item C<oldest_transactions_first>
 
 By default, RT shows newest transactions at the bottom of the ticket
diff --git a/lib/RT/Graph/Tickets.pm b/lib/RT/Graph/Tickets.pm
index 10c706f..72493dd 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -50,6 +50,7 @@ package RT::Graph::Tickets;
 
 use strict;
 use warnings;
+use Try::Tiny;
 
 =head1 NAME
 
@@ -57,13 +58,18 @@ RT::Graph::Tickets - view relations between tickets as graphs
 
 =cut
 
-unless ($RT::DisableGraphViz) {
-    require IPC::Run;
-    IPC::Run->import;
-    require IPC::Run::SafeHandles;
-    IPC::Run::SafeHandles->import;
-    require GraphViz;
-    GraphViz->import;
+unless (RT->config->get('disable_graphviz')) {
+    try {
+        require IPC::Run;
+        IPC::Run->import;
+        require IPC::Run::SafeHandles;
+        IPC::Run::SafeHandles->import;
+        require GraphViz;
+        GraphViz->import;
+    } catch {
+        Jifty->log->warn("GraphViz disabled: $@");
+        RT->config->set(disable_graphviz => 1);
+    }
 }
 
 our %ticket_status_style = (
diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index c0549e4..0016a6c 100755
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -96,7 +96,8 @@
 	  </&>
 
 % my (@extra);
-% push @extra, titleright_raw => '<a href="'. RT->config->get('web_path'). '/Ticket/Graphs/index.html?id='.$ticket->id.'">'._('Graph').'</a>' unless RT->config->get('disable_graph_viz');
+% require RT::Graph::Tickets; # XXX: remove this after config post-load check is working again
+% push @extra, titleright_raw => '<a href="'. RT->config->get('web_path'). '/Ticket/Graphs/index.html?id='.$ticket->id.'">'._('Graph').'</a>' unless RT->config->get('disable_graphviz');
 
 	  <&| /Widgets/TitleBox, title => _('Links'), 
 		title_href => RT->config->get('web_path')."/Ticket/ModifyLinks.html?id=".$ticket->id, 
diff --git a/share/html/Ticket/ModifyLinks.html b/share/html/Ticket/ModifyLinks.html
index 37537d2..86a0249 100755
--- a/share/html/Ticket/ModifyLinks.html
+++ b/share/html/Ticket/ModifyLinks.html
@@ -58,7 +58,8 @@
 <input type="hidden" class="hidden" name="id" value="<%$Ticket->id%>" />
 % $m->callback( callback_name => 'FormStart', args_ref => \%ARGS );
 % my (@extra);
-% push @extra, titleright_raw => '<a href="'. RT->config->get('web_path') . '/Ticket/Graphs/index.html?id='.$Ticket->id.'">'._('Graph').'</a>' unless RT->config->get('disable_graph_viz');
+% require RT::Graph::Tickets; # XXX: remove this after config post-load check is working again
+% push @extra, titleright_raw => '<a href="'. RT->config->get('web_path') . '/Ticket/Graphs/index.html?id='.$Ticket->id.'">'._('Graph').'</a>' unless RT->config->get('disable_graphviz');
 <&| /Widgets/TitleBox, title => _('Edit Links'), class=>'ticket-info-links', @extra &>
 <& /Elements/EditLinks, object => $Ticket, merge => 1 &>
 </&>

-----------------------------------------------------------------------


More information about the Rt-commit mailing list