From adc3c7a7b51bd32732d1f65aa9da180c1e6e15d8 Mon Sep 17 00:00:00 2001 From: Matt Selsky Date: Mon, 15 Dec 2014 17:47:48 +0000 Subject: Bug 950486: Move the webdotbase and font_file parameters from data/params into localconfig (and kill the Graphs panel). r=gerv, a=glob. --- Bugzilla/Install/Filesystem.pm | 14 ++++++------ Bugzilla/Install/Localconfig.pm | 11 ++++++++++ Bugzilla/Install/Requirements.pm | 46 +++++++++++++++++++++++++++++++++++----- 3 files changed, 59 insertions(+), 12 deletions(-) (limited to 'Bugzilla/Install') 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 => < - Allow from 192.20.225.0/24 - Deny from all - +# 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. +# +# Allow from 127.0.0.1/24 +# Deny from all +# # Allow access to .png files created by a local copy of 'dot' 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 @@ -108,6 +108,14 @@ use constant LOCALCONFIG_VARS => ( 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 @@ -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 +=item C Description: Checks if the graphviz binary specified in the C 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 + +Description: Checks if the font file specified in the C 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 Description: Tells you whether or not you have the appropriate -- cgit v1.2.3-24-g4f1b