summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Config
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-06-20 05:15:17 +0200
committerlpsolit%gmail.com <>2006-06-20 05:15:17 +0200
commit2545c0950c4f0fde8f78b265217fa9f523eff7bf (patch)
tree5bb305644ad11da196c7613b82743e426e2fd337 /Bugzilla/Config
parentb687ddef9b6dfeec3d87b7ae211decbf21b6e9a9 (diff)
downloadbugzilla-2545c0950c4f0fde8f78b265217fa9f523eff7bf.tar.gz
bugzilla-2545c0950c4f0fde8f78b265217fa9f523eff7bf.tar.xz
Bug 304601: Bugzilla::Config's :locations exports need to be in their own module - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat for the main patch, r=myk for the patch about CGI.pm a=justdave
Bug 328637: Remove all legal_* versioncache arrays - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=justdave Bug 110503 - Eliminate versioncache
Diffstat (limited to 'Bugzilla/Config')
-rw-r--r--Bugzilla/Config/BugFields.pm19
-rw-r--r--Bugzilla/Config/Common.pm53
-rw-r--r--Bugzilla/Config/L10n.pm5
3 files changed, 34 insertions, 43 deletions
diff --git a/Bugzilla/Config/BugFields.pm b/Bugzilla/Config/BugFields.pm
index 17b79941d..ef0f340f1 100644
--- a/Bugzilla/Config/BugFields.pm
+++ b/Bugzilla/Config/BugFields.pm
@@ -34,11 +34,18 @@ package Bugzilla::Config::BugFields;
use strict;
use Bugzilla::Config::Common;
+use Bugzilla::Field;
$Bugzilla::Config::BugFields::sortkey = "04";
sub get_param_list {
my $class = shift;
+
+ my @legal_priorities = @{get_legal_field_values('priority')};
+ my @legal_severities = @{get_legal_field_values('bug_severity')};
+ my @legal_platforms = @{get_legal_field_values('rep_platform')};
+ my @legal_OS = @{get_legal_field_values('op_sys')};
+
my @param_list = (
{
name => 'useclassification',
@@ -85,23 +92,23 @@ sub get_param_list {
{
name => 'defaultpriority',
type => 's',
- choices => \@::legal_priority,
- default => $::legal_priority[-1],
+ choices => \@legal_priorities,
+ default => $legal_priorities[-1],
checker => \&check_priority
},
{
name => 'defaultseverity',
type => 's',
- choices => \@::legal_severity,
- default => $::legal_severity[-1],
+ choices => \@legal_severities,
+ default => $legal_severities[-1],
checker => \&check_severity
},
{
name => 'defaultplatform',
type => 's',
- choices => ['', @::legal_platform],
+ choices => ['', @legal_platforms],
default => '',
checker => \&check_platform
},
@@ -109,7 +116,7 @@ sub get_param_list {
{
name => 'defaultopsys',
type => 's',
- choices => ['', @::legal_opsys],
+ choices => ['', @legal_OS],
default => '',
checker => \&check_opsys
} );
diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm
index 665b889f3..3e6e22a57 100644
--- a/Bugzilla/Config/Common.pm
+++ b/Bugzilla/Config/Common.pm
@@ -29,34 +29,15 @@
# Frédéric Buclin <LpSolit@gmail.com>
#
-# This file defines all the parameters that we have a GUI to edit within
-# Bugzilla.
-
-# ATTENTION!!!! THIS FILE ONLY CONTAINS THE DEFAULTS.
-# You cannot change your live settings by editing this file.
-# Only adding new parameters is done here. Once the parameter exists, you
-# must use %baseurl%/editparams.cgi from the web to edit the settings.
-
-# This file is included via |do|, mainly because of circular dependency issues
-# (such as globals.pl -> Bugzilla::Config -> this -> Bugzilla::Config)
-# which preclude compile time loading.
-
-# Those issues may go away at some point, and the contents of this file
-# moved somewhere else. Please try to avoid more dependencies from here
-# to other code
-
-# (Note that these aren't just added directly to Bugzilla::Config, because
-# the backend prefs code is separate to this...)
-
package Bugzilla::Config::Common;
use strict;
use Socket;
-use Bugzilla::Config qw(:DEFAULT $templatedir $webdotdir);
use Bugzilla::Util;
use Bugzilla::Constants;
+use Bugzilla::Field;
use base qw(Exporter);
@Bugzilla::Config::Common::EXPORT =
@@ -132,40 +113,40 @@ sub check_sslbase {
sub check_priority {
my ($value) = (@_);
- &::GetVersionTable();
- if (lsearch(\@::legal_priority, $value) < 0) {
+ my $legal_priorities = get_legal_field_values('priority');
+ if (lsearch($legal_priorities, $value) < 0) {
return "Must be a legal priority value: one of " .
- join(", ", @::legal_priority);
+ join(", ", @$legal_priorities);
}
return "";
}
sub check_severity {
my ($value) = (@_);
- &::GetVersionTable();
- if (lsearch(\@::legal_severity, $value) < 0) {
+ my $legal_severities = get_legal_field_values('bug_severity');
+ if (lsearch($legal_severities, $value) < 0) {
return "Must be a legal severity value: one of " .
- join(", ", @::legal_severity);
+ join(", ", @$legal_severities);
}
return "";
}
sub check_platform {
my ($value) = (@_);
- &::GetVersionTable();
- if (lsearch(['', @::legal_platform], $value) < 0) {
+ my $legal_platforms = get_legal_field_values('rep_platform');
+ if (lsearch(['', @$legal_platforms], $value) < 0) {
return "Must be empty or a legal platform value: one of " .
- join(", ", @::legal_platform);
+ join(", ", @$legal_platforms);
}
return "";
}
sub check_opsys {
my ($value) = (@_);
- &::GetVersionTable();
- if (lsearch(['', @::legal_opsys], $value) < 0) {
+ my $legal_OS = get_legal_field_values('op_sys');
+ if (lsearch(['', @$legal_OS], $value) < 0) {
return "Must be empty or a legal operating system value: one of " .
- join(", ", @::legal_opsys);
+ join(", ", @$legal_OS);
}
return "";
}
@@ -177,7 +158,7 @@ sub check_shadowdb {
return "";
}
- if (!Param('shadowdbhost')) {
+ if (!Bugzilla->params->{'shadowdbhost'}) {
return "You need to specify a host when using a shadow database";
}
@@ -215,6 +196,7 @@ sub check_webdotbase {
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>)) {
@@ -259,8 +241,8 @@ sub check_user_verify_class {
} elsif ($class eq 'LDAP') {
eval "require Net::LDAP";
return "Error requiring Net::LDAP: '$@'" if $@;
- return "LDAP servername is missing" unless Param("LDAPserver");
- return "LDAPBaseDN is empty" unless Param("LDAPBaseDN");
+ return "LDAP servername is missing" unless Bugzilla->params->{"LDAPserver"};
+ return "LDAPBaseDN is empty" unless Bugzilla->params->{"LDAPBaseDN"};
} else {
return "Unknown user_verify_class '$class' in check_user_verify_class";
}
@@ -282,6 +264,7 @@ sub check_languages {
if(!scalar(@languages)) {
return "You need to specify a language tag."
}
+ my $templatedir = bz_locations()->{'templatedir'};
foreach my $language (@languages) {
if( ! -d "$templatedir/$language/custom"
&& ! -d "$templatedir/$language/default") {
diff --git a/Bugzilla/Config/L10n.pm b/Bugzilla/Config/L10n.pm
index 6fed0ed70..957dce786 100644
--- a/Bugzilla/Config/L10n.pm
+++ b/Bugzilla/Config/L10n.pm
@@ -35,7 +35,7 @@ use strict;
use File::Spec; # for find_languages
-use Bugzilla::Config qw($templatedir);
+use Bugzilla::Constants;
use Bugzilla::Config::Common;
$Bugzilla::Config::L10n::sortkey = "08";
@@ -62,7 +62,8 @@ sub get_param_list {
sub find_languages {
my @languages = ();
- opendir(DIR, $templatedir) || return "Can't open 'template' directory: $!";
+ opendir(DIR, bz_locations()->{'templatedir'})
+ || return "Can't open 'template' directory: $!";
foreach my $dir (readdir(DIR)) {
next unless $dir =~ /^([a-z-]+)$/i;
my $lang = $1;