summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorMatt Selsky <selsky@columbia.edu>2014-12-15 18:47:48 +0100
committerGervase Markham <gerv@gerv.net>2014-12-15 18:47:48 +0100
commitadc3c7a7b51bd32732d1f65aa9da180c1e6e15d8 (patch)
tree5c2a4825b7f0aac15556dfe4ee29129cb238c4db /Bugzilla
parentf264250ff423e53d44fee297b5648f437c910d02 (diff)
downloadbugzilla-adc3c7a7b51bd32732d1f65aa9da180c1e6e15d8.tar.gz
bugzilla-adc3c7a7b51bd32732d1f65aa9da180c1e6e15d8.tar.xz
Bug 950486: Move the webdotbase and font_file parameters from data/params into localconfig (and kill the Graphs panel). r=gerv, a=glob.
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Config/Common.pm48
-rw-r--r--Bugzilla/Install/Filesystem.pm14
-rw-r--r--Bugzilla/Install/Localconfig.pm11
-rw-r--r--Bugzilla/Install/Requirements.pm46
4 files changed, 62 insertions, 57 deletions
diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm
index fe6a2c2c0..f7e37c6fc 100644
--- a/Bugzilla/Config/Common.pm
+++ b/Bugzilla/Config/Common.pm
@@ -24,9 +24,8 @@ use parent qw(Exporter);
@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
@@ -85,7 +84,7 @@ sub check_sslbase {
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.
@@ -221,43 +220,6 @@ sub check_url {
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
@@ -535,10 +497,6 @@ valid group is provided.
=item check_email
-=item check_webdotbase
-
-=item check_font_file
-
=item get_param_list
=item check_maxattachmentsize
diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm
index 523c09fec..2120cbc57 100644
--- a/Bugzilla/Install/Filesystem.pm
+++ b/Bugzilla/Install/Filesystem.pm
@@ -349,13 +349,13 @@ EOT
},
"$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\$>
diff --git a/Bugzilla/Install/Localconfig.pm b/Bugzilla/Install/Localconfig.pm
index 7f473cc77..4ccd107ae 100644
--- a/Bugzilla/Install/Localconfig.pm
+++ b/Bugzilla/Install/Localconfig.pm
@@ -109,6 +109,14 @@ use constant LOCALCONFIG_VARS => (
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
# is larger than anybody would ever be able to brute-force.
@@ -225,6 +233,9 @@ sub update_localconfig {
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
diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm
index 622d1db66..ee50a526a 100644
--- a/Bugzilla/Install/Requirements.pm
+++ b/Bugzilla/Install/Requirements.pm
@@ -30,7 +30,8 @@ our @EXPORT = qw(
FEATURE_FILES
check_requirements
- check_graphviz
+ check_webdotbase
+ check_font_file
have_vers
install_command
map_files_to_features
@@ -655,10 +656,10 @@ sub _translate_feature {
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;
@@ -677,7 +678,7 @@ sub check_graphviz {
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";
}
@@ -687,6 +688,31 @@ sub check_graphviz {
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 {
@@ -910,7 +936,7 @@ optional modules.
=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.
@@ -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.
+=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