From 2545c0950c4f0fde8f78b265217fa9f523eff7bf Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 20 Jun 2006 03:15:17 +0000 Subject: Bug 304601: Bugzilla::Config's :locations exports need to be in their own module - Patch by Frédéric Buclin r=mkanat for the main patch, r=myk for the patch about CGI.pm a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug 328637: Remove all legal_* versioncache arrays - Patch by Frédéric Buclin r=mkanat a=justdave Bug 110503 - Eliminate versioncache --- globals.pl | 99 -------------------------------------------------------------- 1 file changed, 99 deletions(-) (limited to 'globals.pl') diff --git a/globals.pl b/globals.pl index a1e87eec2..6af204666 100644 --- a/globals.pl +++ b/globals.pl @@ -39,23 +39,6 @@ use Bugzilla::Config qw(:DEFAULT ChmodDataFile $localconfig $datadir); 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; @@ -68,88 +51,6 @@ use Date::Parse; # For str2time(). # 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; -- cgit v1.2.3-24-g4f1b