Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
a0196b5d
Commit
a0196b5d
authored
Jun 29, 2006
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 342121: Remove usage of Config qw(:locations) in favor of Constants::bz_locations()
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=justdave
parent
38b17a8f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
68 deletions
+49
-68
Attachment.pm
Bugzilla/Attachment.pm
+4
-2
BugMail.pm
Bugzilla/BugMail.pm
+2
-2
Config.pm
Bugzilla/Config.pm
+7
-41
Hook.pm
Bugzilla/Hook.pm
+2
-1
Mailer.pm
Bugzilla/Mailer.pm
+3
-2
Template.pm
Bugzilla/Template.pm
+6
-3
Hook.pm
Bugzilla/Template/Plugin/Hook.pm
+2
-1
Update.pm
Bugzilla/Update.pm
+4
-4
checksetup.pl
checksetup.pl
+19
-12
No files found.
Bugzilla/Attachment.pm
View file @
a0196b5d
...
...
@@ -47,9 +47,10 @@ that users upload to the Bugzilla server.
=cut
use
Bugzilla::
Constants
;
use
Bugzilla::
Error
;
use
Bugzilla::
Flag
;
use
Bugzilla::
Config
qw(:locations Param)
;
use
Bugzilla::
Config
;
use
Bugzilla::
User
;
use
Bugzilla::
Util
qw(trick_taint)
;
...
...
@@ -384,7 +385,7 @@ sub _get_local_filename {
my
$self
=
shift
;
my
$hash
=
(
$self
->
id
%
100
)
+
100
;
$hash
=~
s/.*(\d\d)$/group.$1/
;
return
"$attachdir
/$hash/attachment."
.
$self
->
id
;
return
bz_locations
()
->
{
'attachdir'
}
.
"
/$hash/attachment."
.
$self
->
id
;
}
sub
_validate_filename
{
...
...
@@ -700,6 +701,7 @@ sub insert_attachment_for_bug {
# If the file is to be stored locally, stream the file from the webserver
# to the local file without reading it into a local variable.
if
(
$cgi
->
param
(
'bigfile'
))
{
my
$attachdir
=
bz_locations
()
->
{
'attachdir'
};
my
$fh
=
$cgi
->
upload
(
'data'
);
my
$hash
=
(
$attachid
%
100
)
+
100
;
$hash
=~
s/.*(\d\d)$/group.$1/
;
...
...
Bugzilla/BugMail.pm
View file @
a0196b5d
...
...
@@ -35,7 +35,7 @@ package Bugzilla::BugMail;
use
Bugzilla::
Error
;
use
Bugzilla::
User
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Config
qw(:DEFAULT $datadir)
;
use
Bugzilla::
Config
;
use
Bugzilla::
Util
;
use
Bugzilla::
Bug
;
use
Bugzilla::
Product
;
...
...
@@ -62,7 +62,7 @@ my %rel_names = (REL_ASSIGNEE , "AssignedTo",
my
%
nomail
;
# This is run when we load the package
if
(
open
(
NOMAIL
,
'<'
,
"$datadir
/nomail"
))
{
if
(
open
(
NOMAIL
,
'<'
,
bz_locations
->
{
'datadir'
}
.
"
/nomail"
))
{
while
(
<
NOMAIL
>
)
{
$nomail
{
trim
(
$_
)}
=
1
;
}
...
...
Bugzilla/Config.pm
View file @
a0196b5d
...
...
@@ -33,43 +33,7 @@ package Bugzilla::Config;
use
strict
;
use
base
qw(Exporter)
;
# 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.
# constant paths
our
$libpath
=
'.'
;
our
$templatedir
=
"$libpath/template"
;
# variable paths
our
$project
;
our
$localconfig
;
our
$datadir
;
if
(
$ENV
{
'PROJECT'
}
&&
$ENV
{
'PROJECT'
}
=~
/^(\w+)$/
)
{
$project
=
$1
;
$localconfig
=
"$libpath/localconfig.$project"
;
$datadir
=
"$libpath/data/$project"
;
}
else
{
$localconfig
=
"$libpath/localconfig"
;
$datadir
=
"$libpath/data"
;
}
our
$attachdir
=
"$datadir/attachments"
;
our
$webdotdir
=
"$datadir/webdot"
;
our
$extensionsdir
=
"$libpath/extensions"
;
use
Bugzilla::
Constants
;
our
@parampanels
=
();
...
...
@@ -84,11 +48,9 @@ our @parampanels = ();
admin
=>
[
qw(UpdateParams SetParam WriteParams)
],
db
=>
[
qw($db_driver $db_host $db_port $db_name $db_user $db_pass $db_sock)
],
localconfig
=>
[
qw($cvsbin $interdiffbin $diffpath $webservergroup)
],
locations
=>
[
qw($libpath $localconfig $attachdir $datadir $templatedir
$webdotdir $project $extensionsdir)
],
params
=>
[
qw(@parampanels)
],
);
Exporter::
export_ok_tags
(
'admin'
,
'db'
,
'localconfig'
,
'
locations'
,
'
params'
);
Exporter::
export_ok_tags
(
'admin'
,
'db'
,
'localconfig'
,
'params'
);
# Bugzilla version
$
Bugzilla::Config::
VERSION
=
"2.23.1+"
;
...
...
@@ -106,10 +68,13 @@ use vars qw(@param_list);
}
# INITIALISATION CODE
# Perl throws a warning if we use bz_locations() directly after do.
my
$localconfig
=
bz_locations
()
->
{
'localconfig'
};
do
$localconfig
;
my
%
params
;
# Load in the param definitions
sub
_load_params
{
my
$libpath
=
bz_locations
()
->
{
'libpath'
};
foreach
my
$item
((
glob
"$libpath/Bugzilla/Config/*.pm"
))
{
$item
=~
m
#/([^/]+)\.pm$#;
my
$module
=
$1
;
...
...
@@ -265,6 +230,7 @@ sub UpdateParams {
sub
WriteParams
{
require
Data::
Dumper
;
my
$datadir
=
bz_locations
()
->
{
'datadir'
};
# This only has an affect for Data::Dumper >= 2.12 (ie perl >= 5.8.0)
# Its just cosmetic, though, so that doesn't matter
...
...
@@ -294,7 +260,7 @@ sub WriteParams {
sub
ChmodDataFile
{
my
(
$file
,
$mask
)
=
@_
;
my
$perm
=
0770
;
if
((
stat
(
$datadir
))[
2
]
&
0002
)
{
if
((
stat
(
bz_locations
()
->
{
'datadir'
}
))[
2
]
&
0002
)
{
$perm
=
0777
;
}
$perm
=
$perm
&
$mask
;
...
...
Bugzilla/Hook.pm
View file @
a0196b5d
...
...
@@ -22,6 +22,7 @@
package
Bugzilla::
Hook
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Util
;
use
Bugzilla::
Error
;
...
...
@@ -32,7 +33,7 @@ sub process {
trick_taint
(
$name
);
# get a list of all extensions
my
@extensions
=
glob
(
$
Bugzilla::Config::
extensionsdir
.
"/*"
);
my
@extensions
=
glob
(
bz_locations
()
->
{
'extensionsdir'
}
.
"/*"
);
# check each extension to see if it uses the hook
# if so, invoke the extension source file:
...
...
Bugzilla/Mailer.pm
View file @
a0196b5d
...
...
@@ -37,7 +37,7 @@ use base qw(Exporter);
@
Bugzilla::Mailer::
EXPORT
=
qw(MessageToMTA)
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Config
qw(:DEFAULT $datadir)
;
use
Bugzilla::
Config
;
use
Bugzilla::
Util
;
use
Mail::
Header
;
...
...
@@ -99,7 +99,8 @@ sub MessageToMTA {
}
my
$mailer
=
new
Mail::
Mailer
Param
(
"mail_delivery_method"
),
@args
;
if
(
Param
(
"mail_delivery_method"
)
eq
"testfile"
)
{
$
Mail::Mailer::testfile::
config
{
outfile
}
=
"$datadir/mailer.testfile"
;
$
Mail::Mailer::testfile::
config
{
outfile
}
=
bz_locations
()
->
{
'datadir'
}
.
'/mailer.testfile'
;
}
$mailer
->
open
(
$headers
->
header_hashref
);
...
...
Bugzilla/Template.pm
View file @
a0196b5d
...
...
@@ -35,7 +35,7 @@ package Bugzilla::Template;
use
strict
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Config
qw(:DEFAULT $templatedir $datadir $project)
;
use
Bugzilla::
Config
;
use
Bugzilla::
Util
;
use
Bugzilla::
User
;
use
Bugzilla::
Error
;
...
...
@@ -110,6 +110,9 @@ sub getTemplateIncludePath {
if
(
$template_include_path
)
{
return
$template_include_path
;
}
my
$templatedir
=
bz_locations
()
->
{
'templatedir'
};
my
$project
=
bz_locations
()
->
{
'project'
};
my
$languages
=
trim
(
Param
(
'languages'
));
if
(
not
(
$languages
=~
/,/
))
{
if
(
$project
)
{
...
...
@@ -159,7 +162,7 @@ sub getTemplateIncludePath {
}
# add in extension template directories:
my
@extensions
=
glob
(
$
Bugzilla::Config::
extensionsdir
.
"/*"
);
my
@extensions
=
glob
(
bz_locations
()
->
{
'extensionsdir'
}
.
"/*"
);
foreach
my
$extension
(
@extensions
)
{
trick_taint
(
$extension
);
# since this comes right from the filesystem
# we have bigger issues if it is insecure
...
...
@@ -533,7 +536,7 @@ sub create {
PRE_CHOMP
=>
1
,
TRIM
=>
1
,
COMPILE_DIR
=>
"$datadir
/template"
,
COMPILE_DIR
=>
bz_locations
()
->
{
'datadir'
}
.
"
/template"
,
# Initialize templates (f.e. by loading plugins like Hook).
PRE_PROCESS
=>
"global/initialize.none.tmpl"
,
...
...
Bugzilla/Template/Plugin/Hook.pm
View file @
a0196b5d
...
...
@@ -26,6 +26,7 @@ package Bugzilla::Template::Plugin::Hook;
use
strict
;
use
Bugzilla::
Config
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Template
;
use
Bugzilla::
Util
;
use
Bugzilla::
Error
;
...
...
@@ -64,7 +65,7 @@ sub process {
my
$type
=
$2
;
# munge the filename to create the extension hook filename:
my
$extensiontemplate
=
$subpath
.
'/'
.
$templatename
.
'-'
.
$hook_name
.
'.'
.
$type
.
'.tmpl'
;
my
@extensions
=
glob
(
$
Bugzilla::Config::
extensionsdir
.
"/*"
);
my
@extensions
=
glob
(
bz_locations
()
->
{
'extensionsdir'
}
.
"/*"
);
my
@usedlanguages
=
getLanguages
();
foreach
my
$extension
(
@extensions
)
{
foreach
my
$language
(
@usedlanguages
)
{
...
...
Bugzilla/Update.pm
View file @
a0196b5d
...
...
@@ -18,10 +18,10 @@ package Bugzilla::Update;
use
strict
;
use
Bugzilla::
Con
fig
qw($datadir)
;
use
Bugzilla::
Con
stants
;
use
constant
REMOTE_FILE
=>
'http://updates.bugzilla.org/bugzilla-update.xml'
;
use
constant
LOCAL_FILE
=>
"/bugzilla-update.xml"
;
# Relative to
$
datadir.
use
constant
LOCAL_FILE
=>
"/bugzilla-update.xml"
;
# Relative to datadir.
use
constant
TIME_INTERVAL
=>
604800
;
# Default is one week, in seconds.
use
constant
TIMEOUT
=>
5
;
# Number of seconds before timeout.
...
...
@@ -34,7 +34,7 @@ sub get_notifications {
eval
(
"require XML::Twig"
);
return
if
$@
;
my
$local_file
=
$datadir
.
LOCAL_FILE
;
my
$local_file
=
bz_locations
()
->
{
'datadir'
}
.
LOCAL_FILE
;
# Update the local XML file if this one doesn't exist or if
# the last modification time (stat[9]) is older than TIME_INTERVAL.
if
(
!-
e
$local_file
||
(
time
()
-
(
stat
(
$local_file
))[
9
]
>
TIME_INTERVAL
))
{
...
...
@@ -127,7 +127,7 @@ sub _synchronize_data {
eval
(
"require LWP::UserAgent"
);
return
if
$@
;
my
$local_file
=
$datadir
.
LOCAL_FILE
;
my
$local_file
=
bz_locations
()
->
{
'datadir'
}
.
LOCAL_FILE
;
my
$ua
=
LWP::
UserAgent
->
new
();
$ua
->
timeout
(
TIMEOUT
);
...
...
checksetup.pl
View file @
a0196b5d
...
...
@@ -510,7 +510,7 @@ BEGIN {
$::ENV
{
'PATH'
}
=
$env
;
require
Bugzilla::
Config
;
import
Bugzilla::
Config
qw(:DEFAULT :admin
:locations
)
;
import
Bugzilla::
Config
qw(:DEFAULT :admin)
;
}
# 12/17/00 justdave@syndicomm.com - removed declarations of the localconfig
...
...
@@ -550,6 +550,7 @@ BEGIN {
print
"Checking user setup ...\n"
unless
$silent
;
$@
=
undef
;
my
$localconfig
=
bz_locations
()
->
{
'localconfig'
};
do
$localconfig
;
if
(
$@
)
{
# capture errors in localconfig, bug 97290
print
STDERR
<<EOT;
...
...
@@ -582,7 +583,7 @@ sub LocalVar
my
(
$name
,
$definition
)
=
@_
;
return
if
LocalVarExists
(
$name
);
# if localconfig declared it, we're done.
$newstuff
.=
" "
.
$name
;
open
FILE
,
'>>'
,
$localconfig
;
open
FILE
,
'>>'
,
bz_locations
()
->
{
'localconfig'
}
;
print
FILE
(
$answer
{
$name
}
or
$definition
),
"\n\n"
;
close
FILE
;
}
...
...
@@ -803,7 +804,8 @@ if (LocalVarExists('mysqlpath')) {
if
(
$newstuff
ne
""
)
{
print
"\nThis version of Bugzilla contains some variables that you may \n"
,
"want to change and adapt to your local settings. Please edit the\n"
,
"file '$localconfig' and rerun checksetup.pl\n\n"
,
"file "
.
bz_locations
()
->
{
'localconfig'
}
.
" and rerun "
,
"checksetup.pl\n\n"
,
"The following variables are new to localconfig since you last ran\n"
,
"checksetup.pl: $newstuff\n\n"
;
exit
;
...
...
@@ -938,6 +940,7 @@ if ($my_db_check) {
# Try to create the DB, and if we fail print an error.
if
(
!
eval
{
$dbh
->
do
(
"CREATE DATABASE $my_db_name"
)
})
{
my
$error
=
$dbh
->
errstr
;
my
$localconfig
=
bz_locations
()
->
{
'localconfig'
};
die
<<"EOF"
The '$my_db_name' database could not be created. The error returned was:
...
...
@@ -1048,7 +1051,7 @@ while (my ($table, $values) = each %$enum_values) {
#
# Create initial --DATA-- directory and make the initial empty files there:
#
my
$datadir
=
bz_locations
()
->
{
'datadir'
};
unless
(
-
d
$datadir
&&
-
e
"$datadir/nomail"
)
{
print
"Creating data directory ($datadir) ...\n"
;
# permissions for non-webservergroup are fixed later on
...
...
@@ -1058,13 +1061,14 @@ unless (-d $datadir && -e "$datadir/nomail") {
open
FILE
,
'>>'
,
"$datadir/mail"
;
close
FILE
;
}
my
$attachdir
=
bz_locations
->
{
'attachdir'
};
unless
(
-
d
$attachdir
)
{
print
"Creating local attachments directory ...\n"
;
# permissions for non-webservergroup are fixed later on
mkdir
$attachdir
,
0770
;
}
my
$extensionsdir
=
bz_locations
->
{
'extensionsdir'
};
# ZLL: 2005-08-20 Create extensions/ if it does not already exist:
unless
(
-
d
$extensionsdir
)
{
print
"Creating extensions directory ($extensionsdir) ...\n"
;
...
...
@@ -1161,6 +1165,7 @@ unless (-d "$datadir/mining") {
mkdir
"$datadir/mining"
,
0700
;
}
my
$webdotdir
=
bz_locations
()
->
{
'webdotdir'
};
unless
(
-
d
"$webdotdir"
)
{
# perms/ownership are fixed up later
mkdir
"$webdotdir"
,
0700
;
...
...
@@ -1277,6 +1282,7 @@ END
chmod
$fileperm
,
"$datadir/.htaccess"
;
}
# Ditto for the template dir
my
$templatedir
=
bz_locations
()
->
{
'templatedir'
};
if
(
!-
e
"$templatedir/.htaccess"
)
{
print
"Creating $templatedir/.htaccess...\n"
;
open
HTACCESS
,
'>'
,
"$templatedir/.htaccess"
;
...
...
@@ -1344,11 +1350,7 @@ END
}
}
# Just to be sure ...
unlink
"$datadir/versioncache"
;
# Check for a new install
my
$newinstall
=
!-
e
"$datadir/params"
;
# Remove parameters from the params file that no longer exist in Bugzilla,
...
...
@@ -1405,6 +1407,7 @@ if ($newinstall) {
# WriteParams will only write out still-valid entries
WriteParams
();
my
$templatedir
=
bz_locations
()
->
{
'templatedir'
};
unless
(
$switch
{
'no_templates'
})
{
if
(
-
e
"$datadir/template"
)
{
print
"Removing existing compiled templates ...\n"
unless
$silent
;
...
...
@@ -1579,7 +1582,8 @@ if ($^O !~ /MSWin32/i) {
fixPerms
(
"$datadir/duplicates"
,
$<
,
$webservergid
,
027
,
1
);
fixPerms
(
"$datadir/mining"
,
$<
,
$webservergid
,
027
,
1
);
fixPerms
(
"$datadir/template"
,
$<
,
$webservergid
,
007
,
1
);
# webserver will write to these
fixPerms
(
$attachdir
,
$<
,
$webservergid
,
007
,
1
);
# webserver will write to these
# webserver will write to attachdir.
fixPerms
(
bz_locations
()
->
{
'attachdir'
},
$<
,
$webservergid
,
007
,
1
);
fixPerms
(
$webdotdir
,
$<
,
$webservergid
,
007
,
1
);
fixPerms
(
"$webdotdir/.htaccess"
,
$<
,
$webservergid
,
027
);
fixPerms
(
"$datadir/params"
,
$<
,
$webservergid
,
017
);
...
...
@@ -4352,6 +4356,11 @@ EOF
NOTNULL
=>
1
});
}
if
(
-
e
"$datadir/versioncache"
)
{
print
"Removing versioncache...\n"
;
unlink
"$datadir/versioncache"
;
}
# If you had to change the --TABLE-- definition in any way, then add your
# differential change code *** A B O V E *** this comment.
...
...
@@ -4778,8 +4787,6 @@ $dbh->do("UPDATE components " .
"SET initialowner = $adminuid "
.
"WHERE initialowner = 0"
);
unlink
"$datadir/versioncache"
;
# Check if the default parameter for urlbase is still set, and if so, give
# notification that they should go and visit editparams.cgi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment