Bug 328637: Remove all legal_* versioncache arrays - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=justdave
Bug 110503 - Eliminate versioncache
use strict;
+use Bugzilla::Constants;
use Bugzilla::Auth;
use Bugzilla::Auth::Persist::Cookie;
use Bugzilla::CGI;
-use Bugzilla::Config qw(:DEFAULT :locations);
-use Bugzilla::Constants;
use Bugzilla::DB;
use Bugzilla::Template;
use Bugzilla::User;
my $authorizer = new Bugzilla::Auth();
$type = LOGIN_REQUIRED if Bugzilla->cgi->param('GoAheadAndLogIn');
if (!defined $type || $type == LOGIN_NORMAL) {
- $type = Param('requirelogin') ? LOGIN_REQUIRED : LOGIN_NORMAL;
+ $type = Bugzilla->params->{'requirelogin'} ? LOGIN_REQUIRED : LOGIN_NORMAL;
}
my $authenticated_user = $authorizer->login($type);
my $class = shift;
if (!$_dbh_shadow) {
- if (Param('shadowdb')) {
+ if (Bugzilla->params->{'shadowdb'}) {
$_dbh_shadow = Bugzilla::DB::connect_shadow();
} else {
$_dbh_shadow = $_dbh_main;
# When we support transactions, need to ->rollback here
$_dbh_main->disconnect if $_dbh_main;
- $_dbh_shadow->disconnect if $_dbh_shadow and Param("shadowdb");
+ $_dbh_shadow->disconnect if $_dbh_shadow && Bugzilla->params->{"shadowdb"};
undef $_dbh_main;
undef $_dbh_shadow;
undef $_dbh;
sub _load_param_values {
my %params;
+ my $datadir = bz_locations()->{'datadir'};
if (-e "$datadir/params") {
# Note that checksetup.pl sets file permissions on '$datadir/params'
use strict;
-use vars qw(@legal_platform
- @legal_priority @legal_severity @legal_opsys @legal_bug_status
- @settable_resolution);
-
use CGI::Carp qw(fatalsToBrowser);
use Bugzilla::Attachment;
return $self->{'choices'} if exists $self->{'choices'};
return {} if $self->{'error'};
- &::GetVersionTable();
-
$self->{'choices'} = {};
$self->{prod_obj} ||= new Bugzilla::Product({name => $self->{product}});
}
# Hack - this array contains "". See bug 106589.
- my @res = grep ($_, @::settable_resolution);
+ my @res = grep ($_, @{settable_resolutions()});
$self->{'choices'} =
{
'product' => \@prodlist,
- 'rep_platform' => \@::legal_platform,
- 'priority' => \@::legal_priority,
- 'bug_severity' => \@::legal_severity,
- 'op_sys' => \@::legal_opsys,
- 'bug_status' => \@::legal_bug_status,
- 'resolution' => \@res,
- 'component' => [map($_->name, @{$self->{prod_obj}->components})],
- 'version' => [map($_->name, @{$self->{prod_obj}->versions})],
+ 'rep_platform' => get_legal_field_values('rep_platform'),
+ 'priority' => get_legal_field_values('priority'),
+ 'bug_severity' => get_legal_field_values('bug_severity'),
+ 'op_sys' => get_legal_field_values('op_sys'),
+ 'bug_status' => get_legal_field_values('bug_status'),
+ 'resolution' => \@res,
+ 'component' => [map($_->name, @{$self->{prod_obj}->components})],
+ 'version' => [map($_->name, @{$self->{prod_obj}->versions})],
'target_milestone' => [map($_->name, @{$self->{prod_obj}->milestones})],
};
return $self->{'choices'};
}
+# List of resolutions that may be set directly by hand in the bug form.
+# 'MOVED' and 'DUPLICATE' are excluded from the list because setting
+# bugs to those resolutions requires a special process.
+sub settable_resolutions {
+ my $resolutions = get_legal_field_values('resolution');
+ my $pos = lsearch($resolutions, 'DUPLICATE');
+ if ($pos >= 0) {
+ splice(@$resolutions, $pos, 1);
+ }
+ $pos = lsearch($resolutions, 'MOVED');
+ if ($pos >= 0) {
+ splice(@$resolutions, $pos, 1);
+ }
+ return $resolutions;
+}
+
# Convenience Function. If you need speed, use this. If you need
# other Bug fields in addition to this, just create a new Bug with
# the alias.
# This hash usually comes from the "mailrecipients" var in a template call.
sub Send {
my ($id, $forced) = (@_);
-
- # This only works in a sub. Probably something to do with the
- # require abuse we do.
- &::GetVersionTable();
-
return ProcessOneBug($id, $forced);
}
use Bugzilla::Error;
use Bugzilla::Util;
-use Bugzilla::Config;
# We need to disable output buffering - see bug 179174
$| = 1;
$self->{Bugzilla_cookie_list} = [];
# Send appropriate charset
- $self->charset(Param('utf8') ? 'UTF-8' : '');
+ $self->charset(Bugzilla->params->{'utf8'} ? 'UTF-8' : '');
# Redirect to SSL if required
- if (Param('sslbase') ne '' and Param('ssl') eq 'always' and i_am_cgi()) {
- $self->require_https(Param('sslbase'));
+ if (Bugzilla->params->{'sslbase'} ne ''
+ && Bugzilla->params->{'ssl'} eq 'always'
+ && i_am_cgi())
+ {
+ $self->require_https(Bugzilla->params->{'sslbase'});
}
# Check for errors
}
# Add the default path and the domain in.
- $paramhash{'-path'} = Param('cookiepath');
- $paramhash{'-domain'} = Param('cookiedomain') if Param('cookiedomain');
+ $paramhash{'-path'} = Bugzilla->params->{'cookiepath'};
+ $paramhash{'-domain'} = Bugzilla->params->{'cookiedomain'}
+ if Bugzilla->params->{'cookiedomain'};
# Move the param list back into an array for the call to cookie().
foreach (keys(%paramhash)) {
do $localconfig;
my %params;
# Load in the param definitions
-foreach my $item ((glob "$libpath/Bugzilla/Config/*.pm")) {
- $item =~ m#/([^/]+)\.pm$#;
- my $module = $1;
- next if ($module eq 'Common');
- require "Bugzilla/Config/$module.pm";
- my @new_param_list = "Bugzilla::Config::$module"->get_param_list();
- foreach my $item (@new_param_list) {
- $params{$item->{'name'}} = $item;
+sub _load_params {
+ foreach my $item ((glob "$libpath/Bugzilla/Config/*.pm")) {
+ $item =~ m#/([^/]+)\.pm$#;
+ my $module = $1;
+ next if ($module eq 'Common');
+ require "Bugzilla/Config/$module.pm";
+ my @new_param_list = "Bugzilla::Config::$module"->get_param_list();
+ foreach my $item (@new_param_list) {
+ $params{$item->{'name'}} = $item;
+ }
+ push(@parampanels, $module);
+ push(@param_list, @new_param_list);
}
- push(@parampanels, $module);
- push(@param_list, @new_param_list);
}
-
# END INIT CODE
# Subroutines go here
sub Param {
my ($param) = @_;
+ _load_params unless %params;
my %param_values = %{Bugzilla->params};
# By this stage, the param must be in the hash
sub SetParam {
my ($name, $value) = @_;
+ _load_params unless %params;
die "Unknown param $name" unless (exists $params{$name});
my $entry = $params{$name};
# Note that this isn't particularly 'clean' in terms of separating
# the backend code (ie this) from the actual params.
# We don't care about that, though
-
my $param = Bugzilla->params;
# Old Bugzilla versions stored the version number in the params file
# --- DEFAULTS FOR NEW PARAMS ---
+ _load_params unless %params;
foreach my $item (@param_list) {
my $name = $item->{'name'};
$param->{$name} = $item->{'default'} unless exists $param->{$name};
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',
{
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
},
{
name => 'defaultopsys',
type => 's',
- choices => ['', @::legal_opsys],
+ choices => ['', @legal_OS],
default => '',
checker => \&check_opsys
} );
# 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 =
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 "";
}
return "";
}
- if (!Param('shadowdbhost')) {
+ if (!Bugzilla->params->{'shadowdbhost'}) {
return "You need to specify a host when using a shadow database";
}
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>)) {
} 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";
}
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") {
use File::Spec; # for find_languages
-use Bugzilla::Config qw($templatedir);
+use Bugzilla::Constants;
use Bugzilla::Config::Common;
$Bugzilla::Config::L10n::sortkey = "08";
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;
use base qw(Exporter);
@Bugzilla::Constants::EXPORT = qw(
+ bz_locations
CONTROLMAPNA
CONTROLMAPSHOWN
CONTROLMAPDEFAULT
use constant BUG_STATE_OPEN => ('NEW', 'REOPENED', 'ASSIGNED',
'UNCONFIRMED');
-1;
-
# Data about what we require for different databases.
use constant DB_MODULE => {
'mysql' => {db => 'Bugzilla::DB::Mysql', db_version => '4.0.14',
dbd => 'DBD::Pg', dbd_version => '1.45',
name => 'PostgreSQL'},
};
+
+# Under mod_perl, get this from a .htaccess config variable,
+# and/or default from the current 'real' dir.
+# At some stage after this, it may be possible for these dir locations
+# to go into localconfig. localconfig can't be specified in a config file,
+# except possibly with mod_perl. If you move localconfig, you need to change
+# the define here.
+# $libpath is really only for mod_perl; its not yet possible to move the
+# .pms elsewhere.
+# $webdotdir must be in the webtree somewhere. Even if you use a local dot,
+# we output images to there. Also, if $webdot dir is not relative to the
+# bugzilla root directory, you'll need to change showdependencygraph.cgi to
+# set image_url to the correct location.
+# The script should really generate these graphs directly...
+# Note that if $libpath is changed, some stuff will break, notably dependency
+# graphs (since the path will be wrong in the HTML). This will be fixed at
+# some point.
+sub bz_locations {
+ my $libpath = '.';
+ my $project;
+ my $localconfig;
+ my $datadir;
+ if ($ENV{'PROJECT'} && $ENV{'PROJECT'} =~ /^(\w+)$/) {
+ $project = $1;
+ $localconfig = "$libpath/localconfig.$project";
+ $datadir = "$libpath/data/$project";
+ } else {
+ $localconfig = "$libpath/localconfig";
+ $datadir = "$libpath/data";
+ }
+
+ # Returns a hash of paths.
+ return {
+ 'libpath' => $libpath,
+ 'templatedir' => "$libpath/template",
+ 'project' => $project,
+ 'localconfig' => $localconfig,
+ 'datadir' => $datadir,
+ 'attachdir' => "$datadir/attachments",
+ 'webdotdir' => "$datadir/webdot",
+ 'extensionsdir' => "$libpath/extensions"
+ };
+}
+
+1;
@Bugzilla::Error::EXPORT = qw(ThrowCodeError ThrowTemplateError ThrowUserError);
-use Bugzilla::Config qw($datadir);
use Bugzilla::Constants;
use Bugzilla::Util;
use Date::Format;
# and the transaction is rolled back (if supported)
Bugzilla->dbh->bz_unlock_tables(UNLOCK_ABORT);
+ my $datadir = bz_locations()->{'datadir'};
# If a writable $datadir/errorlog exists, log error details there.
if (-w "$datadir/errorlog") {
require Data::Dumper;
# Try a template first; but if this one fails too, fall back
# on plain old print statements.
if (!$template->process("global/code-error.html.tmpl", $vars)) {
- my $maintainer = Bugzilla::Config::Param('maintainer');
- my $error = Bugzilla::Util::html_quote($vars->{'template_error_msg'});
- my $error2 = Bugzilla::Util::html_quote($template->error());
+ my $maintainer = Bugzilla->params->{'maintainer'};
+ my $error = html_quote($vars->{'template_error_msg'});
+ my $error2 = html_quote($template->error());
print <<END;
<tt>
<p>
use strict;
use base qw(Exporter);
-@Bugzilla::Field::EXPORT = qw(check_field get_field_id);
+@Bugzilla::Field::EXPORT = qw(check_field get_field_id get_legal_field_values);
use Bugzilla::Util;
use Bugzilla::Constants;
return @fields;
}
+=pod
+
+=over
+
+=item C<get_legal_field_values($field)>
+
+Description: returns all the legal values for a field that has a
+ list of legal values, like rep_platform or resolution.
+ The table where these values are stored must at least have
+ the following columns: value, isactive, sortkey.
+
+Params: C<$field> - Name of the table where valid values are.
+
+Returns: a reference to a list of valid values.
+
+=back
+
+=cut
+
+sub get_legal_field_values {
+ my ($field) = @_;
+ my $dbh = Bugzilla->dbh;
+ my $result_ref = $dbh->selectcol_arrayref(
+ "SELECT value FROM $field
+ WHERE isactive = ?
+ ORDER BY sortkey, value", undef, (1));
+ return $result_ref;
+}
+
+
=pod
=head2 Data Validation
Description: Makes sure the field $name is defined and its $value
is non empty. If @legal_values is defined, this routine
- also checks whether its value is one of the legal values
- associated with this field. If the test is successful,
+ checks whether its value is one of the legal values
+ associated with this field, else it checks against
+ the default valid values for this field obtained by
+ C<get_legal_field_values($name)>. If the test is successful,
the function returns 1. If the test fails, an error
is thrown (by default), unless $no_warn is true, in which
case the function returns 0.
Params: $name - the field name
$value - the field value
- @legal_values - (optional) ref to a list of legal values
+ @legal_values - (optional) list of legal values
$no_warn - (optional) do not throw an error if true
Returns: 1 on success; 0 on failure if $no_warn is true (else an
my ($name, $value, $legalsRef, $no_warn) = @_;
my $dbh = Bugzilla->dbh;
+ # If $legalsRef is undefined, we use the default valid values.
+ unless (defined $legalsRef) {
+ $legalsRef = get_legal_field_values($name);
+ }
+
if (!defined($value)
|| trim($value) eq ""
- || (defined($legalsRef) && lsearch($legalsRef, $value) < 0))
+ || lsearch($legalsRef, $value) < 0)
{
return 0 if $no_warn; # We don't want an error to be thrown; return.
trick_taint($name);
- my ($result) = $dbh->selectrow_array('SELECT description FROM fielddefs
- WHERE name = ?', undef, $name);
- my $field = $result || $name;
- ThrowCodeError('illegal_field', { field => $field });
+ my $field = new Bugzilla::Field($name);
+ my $field_desc = $field ? $field->description : $name;
+ ThrowCodeError('illegal_field', { field => $field_desc });
}
return 1;
}
my $dbh = Bugzilla->dbh;
- &::GetVersionTable();
-
# First, deal with all the old hard-coded non-chart-based poop.
if (grep(/map_assigned_to/, @$fieldsref)) {
push @supptables, "INNER JOIN profiles AS map_assigned_to " .
# into their equivalent lists of open and closed statuses.
if ($params->param('bug_status')) {
my @bug_statuses = $params->param('bug_status');
- if (scalar(@bug_statuses) == scalar(@::legal_bug_status)
+ my @legal_statuses = @{get_legal_field_values('bug_status')};
+ if (scalar(@bug_statuses) == scalar(@legal_statuses)
|| $bug_statuses[0] eq "__all__")
{
$params->delete('bug_status');
}
elsif ($bug_statuses[0] eq '__open__') {
$params->param('bug_status', map(is_open_state($_) ? $_ : undef,
- @::legal_bug_status));
+ @legal_statuses));
}
elsif ($bug_statuses[0] eq "__closed__") {
$params->param('bug_status', map(is_open_state($_) ? undef : $_,
- @::legal_bug_status));
+ @legal_statuses));
}
}
if ($params->param('resolution')) {
my @resolutions = $params->param('resolution');
-
- if (scalar(@resolutions) == scalar(@::legal_resolution)) {
+ my $legal_resolutions = get_legal_field_values('resolution');
+ if (scalar(@resolutions) == scalar(@$legal_resolutions)) {
$params->delete('resolution');
}
}
},
"^keywords,(?!changed)" => sub {
- &::GetVersionTable();
my @list;
my $table = "keywords_$chartid";
foreach my $value (split(/[\s,]+/, $v)) {
use Bugzilla::Constants;
use Bugzilla::Keyword;
use Bugzilla::Bug;
+use Bugzilla::Field;
use base qw(Exporter);
@Bugzilla::Search::Quicksearch::EXPORT = qw(quicksearch);
}
# It's no alias either, so it's a more complex query.
-
- &::GetVersionTable();
+ my $legal_statuses = get_legal_field_values('bug_status');
+ my $legal_resolutions = get_legal_field_values('resolution');
# Globally translate " AND ", " OR ", " NOT " to space, pipe, dash.
$searchstring =~ s/\s+AND\s+/ /g;
my @closedStates;
my (%states, %resolutions);
- foreach (@::legal_bug_status) {
+ foreach (@$legal_statuses) {
push(@closedStates, $_) unless is_open_state($_);
}
foreach (@openStates) { $states{$_} = 1 }
if ($words[0] eq 'ALL') {
- foreach (@::legal_bug_status) { $states{$_} = 1 }
+ foreach (@$legal_statuses) { $states{$_} = 1 }
shift @words;
}
elsif ($words[0] eq 'OPEN') {
\%resolutions,
[split(/,/, substr($words[0], 1))],
\@closedStates,
- \@::legal_resolution)) {
+ $legal_resolutions)) {
shift @words;
# Allowing additional resolutions means we need to keep
# the "no resolution" resolution.
if (matchPrefixes(\%states,
\%resolutions,
[split(/,/, $words[0])],
- \@::legal_bug_status,
- \@::legal_resolution)) {
+ $legal_statuses,
+ $legal_resolutions)) {
shift @words;
}
else {
}
# Severity
elsif (grep({lc($word) eq substr($_, 0, 3)}
- @::legal_severity)) {
+ @{get_legal_field_values('bug_severity')})) {
addChart('bug_severity', 'substring',
$word, $negate);
}
use Bugzilla::Bug;
use Bugzilla::Product;
use Bugzilla::Keyword;
+use Bugzilla::Field;
# Include the Bugzilla CGI and general utility library.
require "globals.pl";
-use vars qw(@legal_platform
- @legal_priority
- @legal_severity
- @settable_resolution);
-
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
|| ThrowUserError("auth_failure", {group => "editbugs",
action => "modify",
object => "multiple_bugs"});
- GetVersionTable();
}
# Hack to support legacy applications that think the RDF ctype is at format=rdf.
$vars->{'use_keywords'} = 1 if Bugzilla::Keyword::keyword_count();
$vars->{'products'} = Bugzilla->user->get_enterable_products;
- $vars->{'platforms'} = \@::legal_platform;
- $vars->{'op_sys'} = \@::legal_opsys;
- $vars->{'priorities'} = \@::legal_priority;
- $vars->{'severities'} = \@::legal_severity;
- $vars->{'resolutions'} = \@::settable_resolution;
+ $vars->{'platforms'} = get_legal_field_values('rep_platform');
+ $vars->{'op_sys'} = get_legal_field_values('op_sys');
+ $vars->{'priorities'} = get_legal_field_values('priority');
+ $vars->{'severities'} = get_legal_field_values('bug_severity');
+ $vars->{'resolutions'} = Bugzilla::Bug->settable_resolutions;
$vars->{'unconfirmedstate'} = 'UNCONFIRMED';
Bugzilla->login();
-GetVersionTable();
-
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
chdir("..");
}
-GetVersionTable();
-
# Let Throw*Error() work correctly outside a web browser.
Bugzilla->batch(1);
Bugzilla->switch_to_shadow_db();
use Bugzilla::Constants;
use Bugzilla::Keyword;
use Bugzilla::Bug;
-
-# Suppress "used only once" warnings.
-use vars
- qw(
- @legal_priority
- @legal_severity
- @legal_platform
- @legal_opsys
- @legal_resolution
- );
-
-# Use the global template variables defined in globals.pl
-# to generate the output.
+use Bugzilla::Field;
my $user = Bugzilla->login(LOGIN_OPTIONAL);
display_data();
}
-# Retrieve this installation's configuration.
-GetVersionTable();
-
# Pass a bunch of Bugzilla configuration to the templates.
my $vars = {};
-$vars->{'priority'} = \@::legal_priority;
-$vars->{'severity'} = \@::legal_severity;
-$vars->{'platform'} = \@::legal_platform;
-$vars->{'op_sys'} = \@::legal_opsys;
+$vars->{'priority'} = get_legal_field_values('priority');
+$vars->{'severity'} = get_legal_field_values('bug_severity');
+$vars->{'platform'} = get_legal_field_values('rep_platform');
+$vars->{'op_sys'} = get_legal_field_values('op_sys');
$vars->{'keyword'} = [map($_->name, Bugzilla::Keyword->get_all)];
-$vars->{'resolution'} = \@::legal_resolution;
-$vars->{'status'} = \@::legal_bug_status;
+$vars->{'resolution'} = get_legal_field_values('resolution');
+$vars->{'status'} = get_legal_field_values('bug_status');
# Include a list of product objects.
$vars->{'products'} = $user->get_selectable_products;
# be made part of the configuration.
my @open_status;
my @closed_status;
-foreach my $status (@::legal_bug_status) {
+foreach my $status (@{$vars->{'status'}}) {
is_open_state($status) ? push(@open_status, $status)
: push(@closed_status, $status);
}
ask in the newsgroup.
</para>
</section>
-
- <section id="dbmodify">
- <title>Modifying Your Running System</title>
-
- <para>
- Bugzilla optimizes database lookups by storing all relatively
- static information in the <filename>versioncache</filename>
- file, located in the <filename class="directory">data/</filename>
- subdirectory under your installation directory.
- </para>
-
- <para>
- If you make a change to the structural data in your database (the
- versions table for example), or to the <quote>constants</quote>
- encoded in <filename>defparams.pl</filename>, you will need to remove
- the cached content from the data directory (by doing a
- <command>rm data/versioncache</command>), or your changes won't show up.
- </para>
-
- <para>
- <filename>versioncache</filename> gets regenerated automatically
- whenever it's more than an hour old, so Bugzilla will eventually
- notice your changes by itself, but generally you want it to notice
- right away, so that you can test things.
- </para>
- </section>
<section id="dbdoc">
<title>MySQL Bugzilla Database Introduction</title>
my $template = Bugzilla->template;
my $vars = {};
-GetVersionTable();
-
# collectstats.pl uses duplicates.cgi to generate the RDF duplicates stats.
# However, this conflicts with requirelogin if it's enabled; so we make
# logging-in optional if we are running from the command line.
$dbh->do("INSERT INTO classifications (name, description)
VALUES (?, ?)", undef, ($class_name, $description));
- # Make versioncache flush
- unlink "$datadir/versioncache";
-
$vars->{'classification'} = $class_name;
LoadTemplate($action);
$dbh->bz_unlock_tables();
- unlink "$datadir/versioncache";
-
$vars->{'classification'} = $classification;
LoadTemplate($action);
trick_taint($class_name);
$dbh->do("UPDATE classifications SET name = ? WHERE id = ?",
undef, ($class_name, $class_old->id));
-
- $vars->{'updated_classification'} = 1;
- unlink "$datadir/versioncache";
+ $vars->{'updated_classification'} = 1;
}
if ($description ne $class_old->description) {
($description, $class_old->id));
$vars->{'updated_description'} = 1;
-
- unlink "$datadir/versioncache";
}
$dbh->bz_unlock_tables();
# Insert default charting queries for this product.
# If they aren't using charting, this won't do any harm.
- GetVersionTable();
-
my @series;
my $prodcomp = "&product=" . url_quote($product->name) .
$series->writeToDatabase();
}
- # Make versioncache flush
- unlink "$datadir/versioncache";
-
$component =
new Bugzilla::Component({product_id => $product->id,
name => $comp_name});
$dbh->bz_unlock_tables();
- unlink "$datadir/versioncache";
-
$vars->{'comp'} = $component;
$vars->{'product'} = $product;
$template->process("admin/components/deleted.html.tmpl", $vars)
$dbh->do("UPDATE components SET name = ? WHERE id = ?",
undef, ($comp_name, $component_old->id));
- unlink "$datadir/versioncache";
$vars->{'updated_name'} = 1;
}
(id, name, description) VALUES (?, ?, ?)',
undef, ($newid, $name, $description));
- # Make versioncache flush
- unlink "$datadir/versioncache";
-
print $cgi->header();
$vars->{'name'} = $name;
$dbh->do('UPDATE keyworddefs SET name = ?, description = ?
WHERE id = ?', undef, ($name, $description, $id));
- # Make versioncache flush
- unlink "$datadir/versioncache";
-
print $cgi->header();
$vars->{'name'} = $name;
$dbh->do('DELETE FROM keywords WHERE keywordid = ?', undef, $id);
$dbh->do('DELETE FROM keyworddefs WHERE id = ?', undef, $id);
- # Make versioncache flush
- unlink "$datadir/versioncache";
-
print $cgi->header();
$vars->{'name'} = $name;
VALUES ( ?, ?, ? )',
undef, $milestone_name, $product->id, $sortkey);
- # Make versioncache flush
- unlink "$datadir/versioncache";
-
$milestone = new Bugzilla::Milestone($product->id,
$milestone_name);
$vars->{'milestone'} = $milestone;
$dbh->do("DELETE FROM milestones WHERE product_id = ? AND value = ?",
undef, ($product->id, $milestone->name));
- unlink "$datadir/versioncache";
-
$template->process("admin/milestones/deleted.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
$product->id,
$milestone_old->name);
- unlink "$datadir/versioncache";
$vars->{'updated_sortkey'} = 1;
}
$product->id,
$milestone_old->name);
- unlink "$datadir/versioncache";
-
$vars->{'updated_name'} = 1;
}
$current_panel =~ /^([A-Za-z0-9_-]+)$/;
$current_panel = $1;
-GetVersionTable();
-
my $current_module;
my @panels = ();
foreach my $panel (@parampanels) {
next if ($panel eq 'Common');
require "Bugzilla/Config/$panel.pm";
- my @module_param_list = "Bugzilla::Config::${panel}"->get_param_list();
+ my @module_param_list = "Bugzilla::Config::${panel}"->get_param_list(1);
my $item = { name => lc($panel),
current => ($current_panel eq lc($panel)) ? 1 : 0,
param_list => \@module_param_list,
if ($action eq 'save' && $current_module) {
my @changes = ();
- my @module_param_list = "Bugzilla::Config::${current_module}"->get_param_list();
+ my @module_param_list = "Bugzilla::Config::${current_module}"->get_param_list(1);
foreach my $i (@module_param_list) {
my $name = $i->{'name'};
$vars->{'param_changed'} = \@changes;
WriteParams();
- unlink "$datadir/versioncache";
}
$template->process("admin/params/editparams.html.tmpl", $vars)
use Bugzilla::Milestone;
use Bugzilla::Group;
use Bugzilla::User;
-
-# Shut up misguided -w warnings about "used only once". "use vars" just
-# doesn't work for me.
-use vars qw(@legal_bug_status @legal_resolution);
+use Bugzilla::Field;
#
# Preliminary checks:
if ($cgi->param('createseries')) {
# Insert default charting queries for this product.
# If they aren't using charting, this won't do any harm.
- GetVersionTable();
-
+ #
# $open_name and $product are sqlquoted by the series code
# and never used again here, so we can trick_taint them.
my $open_name = $cgi->param('open_name');
my @series;
# We do every status, every resolution, and an "opened" one as well.
- foreach my $bug_status (@::legal_bug_status) {
+ foreach my $bug_status (@{get_legal_field_values('bug_status')}) {
push(@series, [$bug_status,
"bug_status=" . url_quote($bug_status)]);
}
- foreach my $resolution (@::legal_resolution) {
+ foreach my $resolution (@{get_legal_field_values('resolution')}) {
next if !$resolution;
push(@series, [$resolution, "resolution=" .url_quote($resolution)]);
}
$series->writeToDatabase();
}
}
- # Make versioncache flush
- unlink "$datadir/versioncache";
-
$vars->{'product'} = $product;
-
+
$template->process("admin/products/created.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
$dbh->bz_unlock_tables();
- unlink "$datadir/versioncache";
-
$template->process("admin/products/deleted.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
$dbh->bz_unlock_tables();
- unlink "$datadir/versioncache";
my $product = new Bugzilla::Product({name => $product_name});
VALUES ( ?, ? )");
$sth->execute($value, $sortkey);
- unlink "$datadir/versioncache";
-
$vars->{'value'} = $value;
$vars->{'field'} = $field;
$template->process("admin/fieldvalues/created.html.tmpl",
$dbh->bz_unlock_tables();
- unlink "$datadir/versioncache";
-
$vars->{'value'} = $value;
$vars->{'field'} = $field;
$template->process("admin/fieldvalues/deleted.html.tmpl",
$dbh->do("UPDATE $field SET sortkey = ? WHERE value = ?",
undef, $sortkey, $valueold);
- unlink "$datadir/versioncache";
$vars->{'updated_sortkey'} = 1;
$vars->{'sortkey'} = $sortkey;
}
$dbh->do("UPDATE $field SET value = ? WHERE value = ?",
undef, $value, $valueold);
- unlink "$datadir/versioncache";
-
$vars->{'updated_value'} = 1;
}
# If the old value was the default value for the field,
# update data/params accordingly.
# This update is done while tables are unlocked due to the
- # annoying call to GetVersionTable in Bugzilla/Config/Common.pm.
+ # annoying calls in Bugzilla/Config/Common.pm.
if ($value ne $valueold
&& $valueold eq Param($defaults{$field}))
{
SetParam($defaults{$field}, $value);
WriteParams();
- unlink "$datadir/versioncache";
$vars->{'default_value_updated'} = 1;
}
$dbh->do("INSERT INTO versions (value, product_id)
VALUES (?, ?)", undef, ($version_name, $product->id));
- # Make versioncache flush
- unlink "$datadir/versioncache";
-
$version = new Bugzilla::Version($product->id, $version_name);
$vars->{'version'} = $version;
$vars->{'product'} = $product;
$dbh->do("DELETE FROM versions WHERE product_id = ? AND value = ?",
undef, ($product->id, $version->name));
- unlink "$datadir/versioncache";
-
$vars->{'version'} = $version;
$vars->{'product'} = $product;
WHERE product_id = ? AND value = ?", undef,
($version_name, $product->id, $version_old->name));
- unlink "$datadir/versioncache";
-
$vars->{'updated_name'} = 1;
}
use Bugzilla::Classification;
use Bugzilla::Keyword;
use Bugzilla::Token;
+use Bugzilla::Field;
require "globals.pl";
-use vars qw(
- @legal_opsys
- @legal_platform
- @legal_priority
- @legal_severity
-);
-
my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cloned_bug;
$cloned_bug = new Bugzilla::Bug($cloned_bug_id, $user->id);
}
-GetVersionTable();
-
if (scalar(@{$product->components}) == 1) {
# Only one component; just pick it.
$cgi->param('component', $product->components->[0]->name);
$vars->{'product'} = $product;
-$vars->{'priority'} = \@legal_priority;
-$vars->{'bug_severity'} = \@legal_severity;
-$vars->{'rep_platform'} = \@legal_platform;
-$vars->{'op_sys'} = \@legal_opsys;
+$vars->{'priority'} = get_legal_field_values('priority');
+$vars->{'bug_severity'} = get_legal_field_values('bug_severity');
+$vars->{'rep_platform'} = get_legal_field_values('rep_platform');
+$vars->{'op_sys'} = get_legal_field_values('op_sys');
$vars->{'use_keywords'} = 1 if Bugzilla::Keyword::keyword_count();
use Bugzilla::User;
use Bugzilla::Error;
-# Shut up misguided -w warnings about "used only once". For some reason,
-# "use vars" chokes on me when I try it here.
-
-sub globals_pl_sillyness {
- my $zz;
- $zz = @main::legal_bug_status;
- $zz = @main::legal_opsys;
- $zz = @main::legal_platform;
- $zz = @main::legal_priority;
- $zz = @main::legal_severity;
-}
-
-#
-# Here are the --LOCAL-- variables defined in 'localconfig' that we'll use
-# here
-#
-
# XXX - Move this to Bugzilla::Config once code which uses these has moved out
# of globals.pl
do $localconfig;
# Use standard Perl libraries for cross-platform file/directory manipulation.
use File::Spec;
-# XXXX - this needs to go away
-sub GenerateVersionTable {
- my $dbh = Bugzilla->dbh;
-
- @::legal_priority = get_legal_field_values("priority");
- @::legal_severity = get_legal_field_values("bug_severity");
- @::legal_platform = get_legal_field_values("rep_platform");
- @::legal_opsys = get_legal_field_values("op_sys");
- @::legal_bug_status = get_legal_field_values("bug_status");
- @::legal_resolution = get_legal_field_values("resolution");
-
- # 'settable_resolution' is the list of resolutions that may be set
- # directly by hand in the bug form. Start with the list of legal
- # resolutions and remove 'MOVED' and 'DUPLICATE' because setting
- # bugs to those resolutions requires a special process.
- #
- @::settable_resolution = @::legal_resolution;
- my $w = lsearch(\@::settable_resolution, "DUPLICATE");
- if ($w >= 0) {
- splice(@::settable_resolution, $w, 1);
- }
- my $z = lsearch(\@::settable_resolution, "MOVED");
- if ($z >= 0) {
- splice(@::settable_resolution, $z, 1);
- }
-
- require File::Temp;
- my ($fh, $tmpname) = File::Temp::tempfile("versioncache.XXXXX",
- DIR => "$datadir");
-
- print $fh "#\n";
- print $fh "# DO NOT EDIT!\n";
- print $fh "# This file is automatically generated at least once every\n";
- print $fh "# hour by the GenerateVersionTable() sub in globals.pl.\n";
- print $fh "# Any changes you make will be overwritten.\n";
- print $fh "#\n";
-
- require Data::Dumper;
-
- print $fh (Data::Dumper->Dump([\@::legal_priority, \@::legal_severity,
- \@::legal_platform, \@::legal_opsys,
- \@::legal_bug_status, \@::legal_resolution],
- ['*::legal_priority', '*::legal_severity',
- '*::legal_platform', '*::legal_opsys',
- '*::legal_bug_status', '*::legal_resolution']));
-
- print $fh (Data::Dumper->Dump([\@::settable_resolution],
- ['*::settable_resolution']));
-
- print $fh "1;\n";
- close $fh;
-
- rename ($tmpname, "$datadir/versioncache")
- || die "Can't rename $tmpname to versioncache";
- ChmodDataFile("$datadir/versioncache", 0666);
-}
-
-
-$::VersionTableLoaded = 0;
-sub GetVersionTable {
- return if $::VersionTableLoaded;
- my $file_generated = 0;
- if (!-r "$datadir/versioncache") {
- GenerateVersionTable();
- $file_generated = 1;
- }
- require "$datadir/versioncache";
- $::VersionTableLoaded = 1;
-}
-
-# Returns a list of all the legal values for a field that has a
-# list of legal values, like rep_platform or resolution.
-sub get_legal_field_values {
- my ($field) = @_;
- my $dbh = Bugzilla->dbh;
- my $result_ref = $dbh->selectcol_arrayref(
- "SELECT value FROM $field
- WHERE isactive = ?
- ORDER BY sortkey, value", undef, (1));
- return @$result_ref;
-}
-
############# Live code below here (that is, not subroutine defs) #############
use Bugzilla;
use Bugzilla::Util;
use Bugzilla::Constants;
use Bugzilla::Keyword;
+use Bugzilla::Field;
use MIME::Base64;
use MIME::Parser;
use constant DEBUG_LEVEL => 2;
use constant ERR_LEVEL => 1;
-GetVersionTable();
our @logs;
our @attachments;
our $bugtotal;
# Helper sub routines #
###############################################################################
-# This can go away as soon as data/versioncache is removed. Since we still
-# have to use GetVersionTable() though, it stays for now.
-
-sub sillyness {
- my $zz;
- $zz = @::legal_bug_status;
- $zz = @::legal_opsys;
- $zz = @::legal_platform;
- $zz = @::legal_priority;
- $zz = @::legal_severity;
- $zz = @::legal_resolution;
-}
-
sub MailMessage {
return unless ($mail);
my $subject = shift;
exit;
}
-# This will be implemented in Bugzilla::Field as soon as bug 31506 lands
-sub check_field {
- my ($name, $value, $legalsRef, $no_warn) = @_;
- my $dbh = Bugzilla->dbh;
-
- if (!defined($value)
- || trim($value) eq ""
- || (defined($legalsRef) && lsearch($legalsRef, $value) < 0))
- {
- return 0 if $no_warn; # We don't want an error to be thrown; return.
-
- trick_taint($name);
- my ($result) = $dbh->selectrow_array("SELECT description FROM fielddefs
- WHERE name = ?", undef, $name);
-
- my $field = $result || $name;
- ThrowCodeError('illegal_field', { field => $field });
- }
- return 1;
-}
-
# This subroutine handles flags for process_bug. It is generic in that
# it can handle both attachment flags and bug flags.
sub flag_handler {
# imported is valid. If it is not we use the defaults set in the parameters.
if (defined( $bug_fields{'bug_severity'} )
&& check_field('bug_severity', scalar $bug_fields{'bug_severity'},
- \@::legal_severity, ERR_LEVEL) )
+ undef, ERR_LEVEL) )
{
push( @values, $bug_fields{'bug_severity'} );
}
if (defined( $bug_fields{'priority'} )
&& check_field('priority', scalar $bug_fields{'priority'},
- \@::legal_priority, ERR_LEVEL ) )
+ undef, ERR_LEVEL ) )
{
push( @values, $bug_fields{'priority'} );
}
if (defined( $bug_fields{'rep_platform'} )
&& check_field('rep_platform', scalar $bug_fields{'rep_platform'},
- \@::legal_platform, ERR_LEVEL ) )
+ undef, ERR_LEVEL ) )
{
push( @values, $bug_fields{'rep_platform'} );
}
if (defined( $bug_fields{'op_sys'} )
&& check_field('op_sys', scalar $bug_fields{'op_sys'},
- \@::legal_opsys, ERR_LEVEL ) )
+ undef, ERR_LEVEL ) )
{
push( @values, $bug_fields{'op_sys'} );
}
my $has_status = defined($bug_fields{'bug_status'});
my $valid_res = check_field('resolution',
scalar $bug_fields{'resolution'},
- \@::legal_resolution, ERR_LEVEL );
+ undef, ERR_LEVEL );
my $valid_status = check_field('bug_status',
scalar $bug_fields{'bug_status'},
- \@::legal_bug_status, ERR_LEVEL );
+ undef, ERR_LEVEL );
my $is_open = is_open_state($bug_fields{'bug_status'});
my $status = $bug_fields{'bug_status'} || undef;
my $resolution = $bug_fields{'resolution'} || undef;
use Bugzilla::Keyword;
use Bugzilla::Token;
-# Shut up misguided -w warnings about "used only once". For some reason,
-# "use vars" chokes on me when I try it here.
-sub sillyness {
- my $zz;
- $zz = @::legal_opsys;
- $zz = @::legal_platform;
- $zz = @::legal_priority;
- $zz = @::legal_severity;
-}
-
my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
$cgi->param(-name => 'priority', -value => Param('defaultpriority'));
}
-GetVersionTable();
-
# Some more sanity checking
-check_field('rep_platform', scalar $cgi->param('rep_platform'), \@::legal_platform);
-check_field('bug_severity', scalar $cgi->param('bug_severity'), \@::legal_severity);
-check_field('priority', scalar $cgi->param('priority'), \@::legal_priority);
-check_field('op_sys', scalar $cgi->param('op_sys'), \@::legal_opsys);
-check_field('bug_status', scalar $cgi->param('bug_status'), ['UNCONFIRMED', 'NEW']);
+check_field('rep_platform', scalar $cgi->param('rep_platform'));
+check_field('bug_severity', scalar $cgi->param('bug_severity'));
+check_field('priority', scalar $cgi->param('priority'));
+check_field('op_sys', scalar $cgi->param('op_sys'));
+check_field('bug_status', scalar $cgi->param('bug_status'), ['UNCONFIRMED', 'NEW']);
check_field('version', scalar $cgi->param('version'),
[map($_->name, @{$product->versions})]);
check_field('target_milestone', scalar $cgi->param('target_milestone'),
use Bugzilla::Flag;
use Bugzilla::FlagType;
-# Shut up misguided -w warnings about "used only once":
-
-use vars qw(%legal_opsys
- %legal_platform
- %legal_priority
- %settable_resolution
- %legal_severity
- );
-
my $user = Bugzilla->login(LOGIN_REQUIRED);
my $whoid = $user->id;
my $grouplist = $user->groups_as_string;
$vars->{'bug_list'} = \@bug_list;
}
-GetVersionTable();
-
foreach my $field_name ('product', 'component', 'version') {
defined($cgi->param($field_name))
|| ThrowCodeError('undefined_field', { field => $field_name });
check_field('target_milestone', scalar $cgi->param('target_milestone'),
[map($_->name, @{$prod_obj->milestones})]);
}
- check_field('rep_platform', scalar $cgi->param('rep_platform'), \@::legal_platform);
- check_field('op_sys', scalar $cgi->param('op_sys'), \@::legal_opsys);
- check_field('priority', scalar $cgi->param('priority'), \@::legal_priority);
- check_field('bug_severity', scalar $cgi->param('bug_severity'), \@::legal_severity);
+ check_field('rep_platform', scalar $cgi->param('rep_platform'));
+ check_field('op_sys', scalar $cgi->param('op_sys'));
+ check_field('priority', scalar $cgi->param('priority'));
+ check_field('bug_severity', scalar $cgi->param('bug_severity'));
# Those fields only have to exist. We don't validate their value here.
foreach my $field_name ('bug_file_loc', 'short_desc', 'longdesclength') {
/^(resolve|change_resolution)$/ && CheckonComment( "resolve" ) && do {
# Check here, because its the only place we require the resolution
check_field('resolution', scalar $cgi->param('resolution'),
- \@::settable_resolution);
+ Bugzilla::Bug->settable_resolutions);
# don't resolve as fixed while still unresolved blocking bugs
if (Param("noresolveonopenblockers")
use Bugzilla::Util;
use Bugzilla::Product;
use Bugzilla::Keyword;
-
-use vars qw(
- @legal_resolution
- @legal_bug_status
- @legal_opsys
- @legal_platform
- @legal_priority
- @legal_severity
-);
+use Bugzilla::Field;
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
$vars->{'have_keywords'} = Bugzilla::Keyword::keyword_count();
-GetVersionTable();
-
-push @::legal_resolution, "---"; # Oy, what a hack.
-shift @::legal_resolution;
- # Another hack - this array contains "" for some reason. See bug 106589.
-$vars->{'resolution'} = \@::legal_resolution;
+my $legal_resolutions = get_legal_field_values('resolution');
+push(@$legal_resolutions, "---"); # Oy, what a hack.
+# Another hack - this array contains "" for some reason. See bug 106589.
+$vars->{'resolution'} = [grep ($_, @$legal_resolutions)];
my @chfields;
}
@chfields = (sort(@chfields));
$vars->{'chfield'} = \@chfields;
-$vars->{'bug_status'} = \@::legal_bug_status;
-$vars->{'rep_platform'} = \@::legal_platform;
-$vars->{'op_sys'} = \@::legal_opsys;
-$vars->{'priority'} = \@::legal_priority;
-$vars->{'bug_severity'} = \@::legal_severity;
+$vars->{'bug_status'} = get_legal_field_values('bug_status');
+$vars->{'rep_platform'} = get_legal_field_values('rep_platform');
+$vars->{'op_sys'} = get_legal_field_values('op_sys');
+$vars->{'priority'} = get_legal_field_values('priority');
+$vars->{'bug_severity'} = get_legal_field_values('bug_severity');
# Boolean charts
my @fields;
require "globals.pl";
-use vars qw(@legal_opsys @legal_platform @legal_severity);
-
use Bugzilla;
use Bugzilla::Constants;
+use Bugzilla::Field;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
use Bugzilla::Search;
-GetVersionTable();
-
Bugzilla->login();
my $dbh = Bugzilla->switch_to_shadow_db();
my ($names, $isnumeric, $field) = @_;
# These are all the fields we want to preserve the order of in reports.
- my %fields = ('priority' => \@::legal_priority,
- 'bug_severity' => \@::legal_severity,
- 'rep_platform' => \@::legal_platform,
- 'op_sys' => \@::legal_opsys,
- 'bug_status' => \@::legal_bug_status,
- 'resolution' => [' ', @::legal_resolution]);
+ my %fields = ('priority' => get_legal_field_values('priority'),
+ 'bug_severity' => get_legal_field_values('bug_severity'),
+ 'rep_platform' => get_legal_field_values('rep_platform'),
+ 'op_sys' => get_legal_field_values('op_sys'),
+ 'bug_status' => get_legal_field_values('bug_status'),
+ 'resolution' => [' ', @{get_legal_field_values('resolution')}]);
my $field_list = $fields{$field};
my @sorted;
# to viewing reports, as well. Time to check the login in that case.
my $user = Bugzilla->login();
-GetVersionTable();
-
Bugzilla->switch_to_shadow_db();
my $cgi = Bugzilla->cgi;
my $format = $template->get_format("bug/show", scalar $cgi->param('format'),
scalar $cgi->param('ctype'));
-GetVersionTable();
-
my @bugs = ();
my %marks;
my $template = Bugzilla->template;
my $vars = {};
-GetVersionTable();
-
#
# Date handling
#
$cgi->param('Bugzilla_login', $bugzilla_login);
$cgi->param('Bugzilla_password', $bugzilla_password);
-GetVersionTable();
-
$vars->{'changes_saved'} = $cgi->param('dosave');
my $current_tab_name = $cgi->param('tab') || "account";
# Display all the votes for a particular user. If it's the user
# doing the viewing, give them the option to edit them too.
sub show_user {
- GetVersionTable();
-
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
my $user = Bugzilla->user;
############################################################################
# End Data/Security Validation
############################################################################
-
- GetVersionTable();
-
my $who = Bugzilla->user->id;
# If the user is voting for bugs, make sure they aren't overstuffing