Commit adc3c7a7 authored by Matt Selsky's avatar Matt Selsky Committed by Gervase Markham

Bug 950486: Move the webdotbase and font_file parameters from data/params into…

Bug 950486: Move the webdotbase and font_file parameters from data/params into localconfig (and kill the Graphs panel). r=gerv, a=glob.
parent f264250f
...@@ -24,9 +24,8 @@ use parent qw(Exporter); ...@@ -24,9 +24,8 @@ use parent qw(Exporter);
@Bugzilla::Config::Common::EXPORT = @Bugzilla::Config::Common::EXPORT =
qw(check_multi check_numeric check_regexp check_url check_group qw(check_multi check_numeric check_regexp check_url check_group
check_sslbase check_priority check_severity check_platform check_sslbase check_priority check_severity check_platform
check_opsys check_shadowdb check_urlbase check_webdotbase check_opsys check_shadowdb check_urlbase check_user_verify_class
check_user_verify_class check_ip check_font_file check_ip check_mail_delivery_method check_notification check_utf8
check_mail_delivery_method check_notification check_utf8
check_bug_status check_smtp_auth check_theschwartz_available check_bug_status check_smtp_auth check_theschwartz_available
check_maxattachmentsize check_email check_smtp_ssl check_maxattachmentsize check_email check_smtp_ssl
check_comment_taggers_group check_smtp_server check_comment_taggers_group check_smtp_server
...@@ -85,7 +84,7 @@ sub check_sslbase { ...@@ -85,7 +84,7 @@ sub check_sslbase {
my $url = shift; my $url = shift;
if ($url ne '') { if ($url ne '') {
if ($url !~ m#^https://([^/]+).*/$#) { if ($url !~ m#^https://([^/]+).*/$#) {
return "must be a legal URL, that starts with https and ends with a slash."; return "must be a legal URL, that starts with https and ends with a slash";
} }
my $host = $1; my $host = $1;
# Fall back to port 443 if for some reason getservbyname() fails. # Fall back to port 443 if for some reason getservbyname() fails.
...@@ -221,43 +220,6 @@ sub check_url { ...@@ -221,43 +220,6 @@ sub check_url {
return ''; return '';
} }
sub check_webdotbase {
my ($value) = (@_);
$value = trim($value);
if ($value eq "") {
return "";
}
if($value !~ /^https?:/) {
if(! -x $value) {
return "The file path \"$value\" is not a valid executable. Please specify the complete file path to 'dot' if you intend to generate graphs locally.";
}
# Check .htaccess allows access to generated images
my $webdotdir = bz_locations()->{'webdotdir'};
if(-e "$webdotdir/.htaccess") {
open HTACCESS, "$webdotdir/.htaccess";
if(! grep(/ \\\.png\$/,<HTACCESS>)) {
return "Dependency graph images are not accessible.\nAssuming that you have not modified the file, delete $webdotdir/.htaccess and re-run checksetup.pl to rectify.\n";
}
close HTACCESS;
}
}
return "";
}
sub check_font_file {
my ($font) = @_;
$font = trim($font);
return '' unless $font;
if ($font !~ /\.ttf$/) {
return "The file must point to a TrueType font file (its extension must be .ttf)"
}
if (! -f $font) {
return "The file '$font' cannot be found. Make sure you typed the full path to the file"
}
return '';
}
sub check_user_verify_class { sub check_user_verify_class {
# doeditparams traverses the list of params, and for each one it checks, # doeditparams traverses the list of params, and for each one it checks,
# then updates. This means that if one param checker wants to look at # then updates. This means that if one param checker wants to look at
...@@ -535,10 +497,6 @@ valid group is provided. ...@@ -535,10 +497,6 @@ valid group is provided.
=item check_email =item check_email
=item check_webdotbase
=item check_font_file
=item get_param_list =item get_param_list
=item check_maxattachmentsize =item check_maxattachmentsize
......
...@@ -349,13 +349,13 @@ EOT ...@@ -349,13 +349,13 @@ EOT
}, },
"$webdotdir/.htaccess" => { perms => WS_SERVE, contents => <<EOT "$webdotdir/.htaccess" => { perms => WS_SERVE, contents => <<EOT
# Restrict access to .dot files to the public webdot server at research.att.com # If you run a local webdot server, you will need to allow it access to
# if research.att.com ever changes their IP, or if you use a different # generated .dot files. Uncomment this section and replace the IP address with
# webdot server, you'll need to edit this # the IP address of your webdot server.
<FilesMatch \\.dot\$> #<FilesMatch \\.dot\$>
Allow from 192.20.225.0/24 # Allow from 127.0.0.1/24
Deny from all # Deny from all
</FilesMatch> #</FilesMatch>
# Allow access to .png files created by a local copy of 'dot' # Allow access to .png files created by a local copy of 'dot'
<FilesMatch \\.png\$> <FilesMatch \\.png\$>
......
...@@ -109,6 +109,14 @@ use constant LOCALCONFIG_VARS => ( ...@@ -109,6 +109,14 @@ use constant LOCALCONFIG_VARS => (
default => sub { dirname(bin_loc('diff')) }, default => sub { dirname(bin_loc('diff')) },
}, },
{ {
name => 'font_file',
default => '',
},
{
name => 'webdotbase',
default => '',
},
{
name => 'site_wide_secret', name => 'site_wide_secret',
# 64 characters is roughly the equivalent of a 384-bit key, which # 64 characters is roughly the equivalent of a 384-bit key, which
# is larger than anybody would ever be able to brute-force. # is larger than anybody would ever be able to brute-force.
...@@ -225,6 +233,9 @@ sub update_localconfig { ...@@ -225,6 +233,9 @@ sub update_localconfig {
if (exists $answer->{$name}) { if (exists $answer->{$name}) {
$localconfig->{$name} = $answer->{$name}; $localconfig->{$name} = $answer->{$name};
} }
elsif (exists Bugzilla->params->{$name}) {
$localconfig->{$name} = Bugzilla->params->{$name};
}
else { else {
# If the user did not supply an answers file, then they get # If the user did not supply an answers file, then they get
# notified about every variable that gets added. If there was # notified about every variable that gets added. If there was
......
...@@ -30,7 +30,8 @@ our @EXPORT = qw( ...@@ -30,7 +30,8 @@ our @EXPORT = qw(
FEATURE_FILES FEATURE_FILES
check_requirements check_requirements
check_graphviz check_webdotbase
check_font_file
have_vers have_vers
install_command install_command
map_files_to_features map_files_to_features
...@@ -655,10 +656,10 @@ sub _translate_feature { ...@@ -655,10 +656,10 @@ sub _translate_feature {
return join(', ', @strings); return join(', ', @strings);
} }
sub check_graphviz { sub check_webdotbase {
my ($output) = @_; my ($output) = @_;
my $webdotbase = Bugzilla->params->{'webdotbase'}; my $webdotbase = Bugzilla->localconfig->{'webdotbase'};
return 1 if $webdotbase =~ /^https?:/; return 1 if $webdotbase =~ /^https?:/;
my $return; my $return;
...@@ -677,7 +678,7 @@ sub check_graphviz { ...@@ -677,7 +678,7 @@ sub check_graphviz {
if (-e "$webdotdir/.htaccess") { if (-e "$webdotdir/.htaccess") {
my $htaccess = new IO::File("$webdotdir/.htaccess", 'r') my $htaccess = new IO::File("$webdotdir/.htaccess", 'r')
|| die "$webdotdir/.htaccess: " . $!; || die "$webdotdir/.htaccess: " . $!;
if (!grep(/png/, $htaccess->getlines)) { if (!grep(/ \\\.png\$/, $htaccess->getlines)) {
print STDERR install_string('webdot_bad_htaccess', print STDERR install_string('webdot_bad_htaccess',
{ dir => $webdotdir }), "\n"; { dir => $webdotdir }), "\n";
} }
...@@ -687,6 +688,31 @@ sub check_graphviz { ...@@ -687,6 +688,31 @@ sub check_graphviz {
return $return; return $return;
} }
sub check_font_file {
my ($output) = @_;
my $font_file = Bugzilla->localconfig->{'font_file'};
my $readable;
$readable = 1 if -r $font_file;
my $ttf;
$ttf = 1 if $font_file =~ /\.ttf$/;
if ($output) {
_checking_for({ package => 'Font file', ok => $readable && $ttf});
}
if (!$readable) {
print install_string('bad_font_file', { file => $font_file }), "\n";
}
elsif (!$ttf) {
print install_string('bad_font_file_name', { file => $font_file }), "\n";
}
return $readable && $ttf;
}
# This was originally clipped from the libnet Makefile.PL, adapted here for # This was originally clipped from the libnet Makefile.PL, adapted here for
# accurate version checking. # accurate version checking.
sub have_vers { sub have_vers {
...@@ -910,7 +936,7 @@ optional modules. ...@@ -910,7 +936,7 @@ optional modules.
=back =back
=item C<check_graphviz($output)> =item C<check_webdotbase($output)>
Description: Checks if the graphviz binary specified in the Description: Checks if the graphviz binary specified in the
C<webdotbase> parameter is a valid binary, or a valid URL. C<webdotbase> parameter is a valid binary, or a valid URL.
...@@ -920,6 +946,16 @@ Params: C<$output> - C<$true> if you want the function to ...@@ -920,6 +946,16 @@ Params: C<$output> - C<$true> if you want the function to
Returns: C<1> if the check was successful, C<0> otherwise. Returns: C<1> if the check was successful, C<0> otherwise.
=item C<check_font_file($output)>
Description: Checks if the font file specified in the C<font_type> parameter
is a valid-looking font file.
Params: C<$output> - C<$true> if you want the function to
print out information about what it's doing.
Returns: C<1> if the check was successful, C<0> otherwise.
=item C<have_vers($module, $output)> =item C<have_vers($module, $output)>
Description: Tells you whether or not you have the appropriate Description: Tells you whether or not you have the appropriate
......
...@@ -151,7 +151,15 @@ fix_all_file_permissions(!$silent); ...@@ -151,7 +151,15 @@ fix_all_file_permissions(!$silent);
# If we are using a local 'dot' binary, verify the specified binary exists # If we are using a local 'dot' binary, verify the specified binary exists
# and that the generated images are accessible. # and that the generated images are accessible.
check_graphviz(!$silent) if Bugzilla->params->{'webdotbase'}; check_webdotbase(!$silent) if $lc_hash->{'webdotbase'};
###########################################################################
# Check font file setup
###########################################################################
# If we are using a local font file, verify the specified file exists and
# that it has the correct extension.
check_font_file(!$silent) if $lc_hash->{'font_file'};
########################################################################### ###########################################################################
# Changes to the fielddefs --TABLE-- # Changes to the fielddefs --TABLE--
......
...@@ -337,42 +337,6 @@ collapsed_comment_tags ...@@ -337,42 +337,6 @@ collapsed_comment_tags
A comma-separated list of tags which, when applied to comments, will A comma-separated list of tags which, when applied to comments, will
cause them to be collapsed by default. cause them to be collapsed by default.
.. _param-dependency-graphs:
Graphs
======
Bugzilla can draw graphs of bug-dependency relationships, using a tool called
:file:`dot` (from the `GraphViz project <http://graphviz.org/>`_) or a web
service called Web Dot. This page allows you to set the location of the binary
or service. If no Web Dot server or binary is specified, then dependency
graphs will be disabled.
webdotbase
You may set this parameter to any of the following:
* A complete file path to :command:`dot` (part of GraphViz), which will
generate the graphs locally.
* A URL prefix pointing to an installation of the Web Dot package, which
will generate the graphs remotely.
* A blank value, which will disable dependency graphing.
The default value is blank. We recommend using a local install of
:file:`dot`. If you change this value to a web service, make certain that
the Web Dot server can read files from your Web Dot directory. On Apache
you do this by editing the :file:`.htaccess` file; for other systems the
needed measures may vary. You can run :command:`checksetup.pl` to
recreate the :file:`.htaccess` file if it has been lost.
font_file
You can specify the full path to a TrueType font file which will be used
to display text (labels, legends, ...) in charts and graphical reports.
To support as many languages as possible, we recommend to specify a
TrueType font such as Unifont which supports all printable characters in
the Basic Multilingual Plane. If you leave this parameter empty, a default
font will be used, but its support is limited to English characters only
and so other characters will be displayed incorrectly.
.. _param-group-security: .. _param-group-security:
Group Security Group Security
......
...@@ -89,7 +89,7 @@ if ($action eq 'save' && $current_module) { ...@@ -89,7 +89,7 @@ if ($action eq 'save' && $current_module) {
} }
# Stop complaining if the URL has no trailing slash. # Stop complaining if the URL has no trailing slash.
# XXX - This hack can go away once bug 303662 is implemented. # XXX - This hack can go away once bug 303662 is implemented.
if ($name =~ /(?<!webdot)base$/) { if ($name =~ /base$/) {
$value = "$value/" if ($value && $value !~ m#/$#); $value = "$value/" if ($value && $value !~ m#/$#);
} }
} }
......
...@@ -235,7 +235,7 @@ if ($bug_count > MAX_WEBDOT_BUGS) { ...@@ -235,7 +235,7 @@ if ($bug_count > MAX_WEBDOT_BUGS) {
ThrowUserError("webdot_too_large"); ThrowUserError("webdot_too_large");
} }
my $webdotbase = Bugzilla->params->{'webdotbase'}; my $webdotbase = Bugzilla->localconfig->{'webdotbase'};
if ($webdotbase =~ /^https?:/) { if ($webdotbase =~ /^https?:/) {
# Remote dot server. We don't hardcode 'urlbase' here in case # Remote dot server. We don't hardcode 'urlbase' here in case
......
...@@ -595,7 +595,8 @@ ...@@ -595,7 +595,8 @@
<td colspan="2" id="show_dependency_tree_or_graph"> <td colspan="2" id="show_dependency_tree_or_graph">
Show dependency <a href="showdependencytree.cgi?id=[% bug.bug_id %]&amp;hide_resolved=1">tree</a> Show dependency <a href="showdependencytree.cgi?id=[% bug.bug_id %]&amp;hide_resolved=1">tree</a>
[% IF Param('webdotbase') %] [% USE Bugzilla %]
[% IF Bugzilla.localconfig.webdotbase %]
/&nbsp;<a href="showdependencygraph.cgi?id=[% bug.bug_id %]">graph</a> /&nbsp;<a href="showdependencygraph.cgi?id=[% bug.bug_id %]">graph</a>
[% END %] [% END %]
</td> </td>
...@@ -968,7 +969,6 @@ ...@@ -968,7 +969,6 @@
[% BLOCK section_customfields %] [% BLOCK section_customfields %]
[%# *** Custom Fields *** %] [%# *** Custom Fields *** %]
[% USE Bugzilla %]
[% FOREACH field = Bugzilla.active_custom_fields %] [% FOREACH field = Bugzilla.active_custom_fields %]
<tr> <tr>
[% PROCESS bug/field.html.tmpl value = bug.${field.name} [% PROCESS bug/field.html.tmpl value = bug.${field.name}
......
...@@ -34,12 +34,13 @@ ...@@ -34,12 +34,13 @@
END; END;
-%] -%]
[% IF Param("font_file") %] [% USE Bugzilla %]
[% graph.set_x_axis_font(Param("font_file"), 9); [% IF Bugzilla.localconfig.font_file %]
graph.set_x_label_font(Param("font_file"), 10); [% graph.set_x_axis_font(Bugzilla.localconfig.font_file, 9);
graph.set_y_axis_font(Param("font_file"), 9); graph.set_x_label_font(Bugzilla.localconfig.font_file, 10);
graph.set_y_label_font(Param("font_file"), 10); graph.set_y_axis_font(Bugzilla.localconfig.font_file, 9);
graph.set_legend_font(Param("font_file"), 9); graph.set_y_label_font(Bugzilla.localconfig.font_file, 10);
graph.set_legend_font(Bugzilla.localconfig.font_file, 9);
%] %]
[% END %] [% END %]
......
...@@ -36,12 +36,13 @@ ...@@ -36,12 +36,13 @@
END; END;
-%] -%]
[% IF Param("font_file") %] [% USE Bugzilla %]
[% graph.set_x_axis_font(Param("font_file"), 9); [% IF Bugzilla.localconfig.font_file %]
graph.set_x_label_font(Param("font_file"), 10); [% graph.set_x_axis_font(Bugzilla.localconfig.font_file, 9);
graph.set_y_axis_font(Param("font_file"), 9); graph.set_x_label_font(Bugzilla.localconfig.font_file, 10);
graph.set_y_label_font(Param("font_file"), 10); graph.set_y_axis_font(Bugzilla.localconfig.font_file, 9);
graph.set_legend_font(Param("font_file"), 9); graph.set_y_label_font(Bugzilla.localconfig.font_file, 10);
graph.set_legend_font(Bugzilla.localconfig.font_file, 9);
%] %]
[% END %] [% END %]
......
...@@ -38,12 +38,13 @@ ...@@ -38,12 +38,13 @@
END; END;
-%] -%]
[% IF Param("font_file") %] [% USE Bugzilla %]
[% graph.set_x_axis_font(Param("font_file"), 9); [% IF Bugzilla.localconfig.font_file %]
graph.set_x_label_font(Param("font_file"), 10); [% graph.set_x_axis_font(Bugzilla.localconfig.font_file, 9);
graph.set_y_axis_font(Param("font_file"), 9); graph.set_x_label_font(Bugzilla.localconfig.font_file, 10);
graph.set_y_label_font(Param("font_file"), 10); graph.set_y_axis_font(Bugzilla.localconfig.font_file, 9);
graph.set_legend_font(Param("font_file"), 9); graph.set_y_label_font(Bugzilla.localconfig.font_file, 10);
graph.set_legend_font(Bugzilla.localconfig.font_file, 9);
%] %]
[% END %] [% END %]
......
...@@ -20,9 +20,10 @@ ...@@ -20,9 +20,10 @@
END; END;
-%] -%]
[% IF Param("font_file") %] [% USE Bugzilla %]
[% graph.set_title_font(Param("font_file"), 10); [% IF Bugzilla.localconfig.font_file %]
graph.set_value_font(Param("font_file"), 9); [% graph.set_title_font(Bugzilla.localconfig.font_file, 10);
graph.set_value_font(Bugzilla.localconfig.font_file, 9);
%] %]
[% END %] [% END %]
......
...@@ -23,6 +23,13 @@ happens when you are not running checksetup.pl as ##root##. To see the ...@@ -23,6 +23,13 @@ happens when you are not running checksetup.pl as ##root##. To see the
problem we ran into, run: ##command## problem we ran into, run: ##command##
END END
bad_executable => 'not a valid executable: ##bin##', bad_executable => 'not a valid executable: ##bin##',
bad_font_file => <<'END',
The file ##file## cannot be found. Make sure you typed the full path to the file
END
bad_font_file_name => <<'END',
The file ##file## must point to a TrueType font file (its extension must be
.ttf)
END
blacklisted => '(blacklisted)', blacklisted => '(blacklisted)',
bz_schema_exists_before_220 => <<'END', bz_schema_exists_before_220 => <<'END',
You are upgrading from a version before 2.20, but the bz_schema table You are upgrading from a version before 2.20, but the bz_schema table
...@@ -215,6 +222,15 @@ For the "Difference Between Two Patches" feature to work, we need to know ...@@ -215,6 +222,15 @@ For the "Difference Between Two Patches" feature to work, we need to know
what directory the "diff" bin is in. (You only need to set this if you what directory the "diff" bin is in. (You only need to set this if you
are using that feature of the Patch Viewer.) are using that feature of the Patch Viewer.)
END END
localconfig_font_file => <<'END',
You can specify the full path to a TrueType font file, which will be used to
display text (labels, legends, ...) in charts and graphical reports. To support
as many languages as possible, we recommend to specify a TrueType font such as
Unifont (http://unifoundry.com/unifont.html), which supports all printable
characters in the Basic Multilingual Plane. If you leave this parameter empty,
a default font will be used, but its support is limited to English characters
only and so other characters will be displayed incorrectly.
END
localconfig_index_html => <<'END', localconfig_index_html => <<'END',
Most web servers will allow you to use index.cgi as a directory Most web servers will allow you to use index.cgi as a directory
index, and many come preconfigured that way, but if yours doesn't index, and many come preconfigured that way, but if yours doesn't
...@@ -252,6 +268,21 @@ a normal webserver environment. ...@@ -252,6 +268,21 @@ a normal webserver environment.
If set to 1, checksetup.pl will set file permissions so that Bugzilla If set to 1, checksetup.pl will set file permissions so that Bugzilla
works in a SuexecUserGroup environment. works in a SuexecUserGroup environment.
END END
localconfig_webdotbase => <<'END',
It is possible to show graphs of dependent bugs. You may set this parameter to
any of the following:
- A complete file path to 'dot' (part of GraphViz (http://www.graphviz.org/))
will generate the graphs locally.
- A URL prefix pointing to an installation of the webdot package will generate
the graphs remotely. (append "/%urlbase%" to the URL prefix)
- A blank value will disable dependency graphing.
If you use a webdot URL prefix, make certain that the webdot server can read
files from your webdot directory. On Apache you do this by editing the
.htaccess file, for other systems the needed measures may vary. You can run
checksetup.pl to recreate the .htaccess file if it has been lost.
END
localconfig_webservergroup => <<'END', localconfig_webservergroup => <<'END',
The name of the group that your web server runs as. On Red Hat The name of the group that your web server runs as. On Red Hat
distributions, this is usually "apache". On Debian/Ubuntu, it is distributions, this is usually "apache". On Debian/Ubuntu, it is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment