@Bugzilla::Config::Common::EXPORT =
qw(check_multi check_numeric check_regexp check_url check_group
check_sslbase check_priority check_severity check_platform
- check_opsys check_shadowdb check_urlbase check_webdotbase
- check_user_verify_class check_ip check_font_file
- check_mail_delivery_method check_notification check_utf8
+ check_opsys check_shadowdb check_urlbase check_user_verify_class
+ check_ip check_mail_delivery_method check_notification check_utf8
check_bug_status check_smtp_auth check_theschwartz_available
check_maxattachmentsize check_email check_smtp_ssl
check_comment_taggers_group check_smtp_server
my $url = shift;
if ($url ne '') {
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;
# Fall back to port 443 if for some reason getservbyname() fails.
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 {
# 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
=item check_email
-=item check_webdotbase
-
-=item check_font_file
-
=item get_param_list
=item check_maxattachmentsize
},
"$webdotdir/.htaccess" => { perms => WS_SERVE, contents => <<EOT
-# Restrict access to .dot files to the public webdot server at research.att.com
-# if research.att.com ever changes their IP, or if you use a different
-# webdot server, you'll need to edit this
-<FilesMatch \\.dot\$>
- Allow from 192.20.225.0/24
- Deny from all
-</FilesMatch>
+# If you run a local webdot server, you will need to allow it access to
+# generated .dot files. Uncomment this section and replace the IP address with
+# the IP address of your webdot server.
+#<FilesMatch \\.dot\$>
+# Allow from 127.0.0.1/24
+# Deny from all
+#</FilesMatch>
# Allow access to .png files created by a local copy of 'dot'
<FilesMatch \\.png\$>
name => 'diffpath',
default => sub { dirname(bin_loc('diff')) },
},
+ {
+ name => 'font_file',
+ default => '',
+ },
+ {
+ name => 'webdotbase',
+ default => '',
+ },
{
name => 'site_wide_secret',
# 64 characters is roughly the equivalent of a 384-bit key, which
if (exists $answer->{$name}) {
$localconfig->{$name} = $answer->{$name};
}
+ elsif (exists Bugzilla->params->{$name}) {
+ $localconfig->{$name} = Bugzilla->params->{$name};
+ }
else {
# If the user did not supply an answers file, then they get
# notified about every variable that gets added. If there was
FEATURE_FILES
check_requirements
- check_graphviz
+ check_webdotbase
+ check_font_file
have_vers
install_command
map_files_to_features
return join(', ', @strings);
}
-sub check_graphviz {
+sub check_webdotbase {
my ($output) = @_;
- my $webdotbase = Bugzilla->params->{'webdotbase'};
+ my $webdotbase = Bugzilla->localconfig->{'webdotbase'};
return 1 if $webdotbase =~ /^https?:/;
my $return;
if (-e "$webdotdir/.htaccess") {
my $htaccess = new IO::File("$webdotdir/.htaccess", 'r')
|| die "$webdotdir/.htaccess: " . $!;
- if (!grep(/png/, $htaccess->getlines)) {
+ if (!grep(/ \\\.png\$/, $htaccess->getlines)) {
print STDERR install_string('webdot_bad_htaccess',
{ dir => $webdotdir }), "\n";
}
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
# accurate version checking.
sub have_vers {
=back
-=item C<check_graphviz($output)>
+=item C<check_webdotbase($output)>
Description: Checks if the graphviz binary specified in the
C<webdotbase> parameter is a valid binary, or a valid URL.
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)>
Description: Tells you whether or not you have the appropriate
# If we are using a local 'dot' binary, verify the specified binary exists
# 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--
A comma-separated list of tags which, when applied to comments, will
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:
Group Security
}
# Stop complaining if the URL has no trailing slash.
# XXX - This hack can go away once bug 303662 is implemented.
- if ($name =~ /(?<!webdot)base$/) {
+ if ($name =~ /base$/) {
$value = "$value/" if ($value && $value !~ m#/$#);
}
}
ThrowUserError("webdot_too_large");
}
-my $webdotbase = Bugzilla->params->{'webdotbase'};
+my $webdotbase = Bugzilla->localconfig->{'webdotbase'};
if ($webdotbase =~ /^https?:/) {
# Remote dot server. We don't hardcode 'urlbase' here in case
<td colspan="2" id="show_dependency_tree_or_graph">
Show dependency <a href="showdependencytree.cgi?id=[% bug.bug_id %]&hide_resolved=1">tree</a>
- [% IF Param('webdotbase') %]
+ [% USE Bugzilla %]
+ [% IF Bugzilla.localconfig.webdotbase %]
/ <a href="showdependencygraph.cgi?id=[% bug.bug_id %]">graph</a>
[% END %]
</td>
[% BLOCK section_customfields %]
[%# *** Custom Fields *** %]
- [% USE Bugzilla %]
[% FOREACH field = Bugzilla.active_custom_fields %]
<tr>
[% PROCESS bug/field.html.tmpl value = bug.${field.name}
END;
-%]
-[% IF Param("font_file") %]
- [% graph.set_x_axis_font(Param("font_file"), 9);
- graph.set_x_label_font(Param("font_file"), 10);
- graph.set_y_axis_font(Param("font_file"), 9);
- graph.set_y_label_font(Param("font_file"), 10);
- graph.set_legend_font(Param("font_file"), 9);
+[% USE Bugzilla %]
+[% IF Bugzilla.localconfig.font_file %]
+ [% graph.set_x_axis_font(Bugzilla.localconfig.font_file, 9);
+ graph.set_x_label_font(Bugzilla.localconfig.font_file, 10);
+ graph.set_y_axis_font(Bugzilla.localconfig.font_file, 9);
+ graph.set_y_label_font(Bugzilla.localconfig.font_file, 10);
+ graph.set_legend_font(Bugzilla.localconfig.font_file, 9);
%]
[% END %]
END;
-%]
-[% IF Param("font_file") %]
- [% graph.set_x_axis_font(Param("font_file"), 9);
- graph.set_x_label_font(Param("font_file"), 10);
- graph.set_y_axis_font(Param("font_file"), 9);
- graph.set_y_label_font(Param("font_file"), 10);
- graph.set_legend_font(Param("font_file"), 9);
+[% USE Bugzilla %]
+[% IF Bugzilla.localconfig.font_file %]
+ [% graph.set_x_axis_font(Bugzilla.localconfig.font_file, 9);
+ graph.set_x_label_font(Bugzilla.localconfig.font_file, 10);
+ graph.set_y_axis_font(Bugzilla.localconfig.font_file, 9);
+ graph.set_y_label_font(Bugzilla.localconfig.font_file, 10);
+ graph.set_legend_font(Bugzilla.localconfig.font_file, 9);
%]
[% END %]
END;
-%]
-[% IF Param("font_file") %]
- [% graph.set_x_axis_font(Param("font_file"), 9);
- graph.set_x_label_font(Param("font_file"), 10);
- graph.set_y_axis_font(Param("font_file"), 9);
- graph.set_y_label_font(Param("font_file"), 10);
- graph.set_legend_font(Param("font_file"), 9);
+[% USE Bugzilla %]
+[% IF Bugzilla.localconfig.font_file %]
+ [% graph.set_x_axis_font(Bugzilla.localconfig.font_file, 9);
+ graph.set_x_label_font(Bugzilla.localconfig.font_file, 10);
+ graph.set_y_axis_font(Bugzilla.localconfig.font_file, 9);
+ graph.set_y_label_font(Bugzilla.localconfig.font_file, 10);
+ graph.set_legend_font(Bugzilla.localconfig.font_file, 9);
%]
[% END %]
END;
-%]
-[% IF Param("font_file") %]
- [% graph.set_title_font(Param("font_file"), 10);
- graph.set_value_font(Param("font_file"), 9);
+[% USE Bugzilla %]
+[% IF Bugzilla.localconfig.font_file %]
+ [% graph.set_title_font(Bugzilla.localconfig.font_file, 10);
+ graph.set_value_font(Bugzilla.localconfig.font_file, 9);
%]
[% END %]
problem we ran into, run: ##command##
END
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)',
bz_schema_exists_before_220 => <<'END',
You are upgrading from a version before 2.20, but the bz_schema table
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
are using that feature of the Patch Viewer.)
+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',
Most web servers will allow you to use index.cgi as a directory
If set to 1, checksetup.pl will set file permissions so that Bugzilla
works in a SuexecUserGroup environment.
+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',
The name of the group that your web server runs as. On Red Hat