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 --- Bugzilla/Constants.pm | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'Bugzilla/Constants.pm') diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 0c451c8c3..0eeb9be66 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -33,6 +33,7 @@ use strict; use base qw(Exporter); @Bugzilla::Constants::EXPORT = qw( + bz_locations CONTROLMAPNA CONTROLMAPSHOWN CONTROLMAPDEFAULT @@ -278,8 +279,6 @@ use constant FIELD_TYPE_FREETEXT => 1; 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', @@ -289,3 +288,48 @@ use constant DB_MODULE => { 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; -- cgit v1.2.3-24-g4f1b