summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-12-31 13:37:48 +0100
committermkanat%bugzilla.org <>2009-12-31 13:37:48 +0100
commit958e1a758168b4908bcdd237518ab85b93d7e1bb (patch)
tree38c132c3c085445da227f608a6e8c405060cc5ec /Bugzilla
parent26f912882a8e99d75d779aeb455f79abf894159b (diff)
downloadbugzilla-958e1a758168b4908bcdd237518ab85b93d7e1bb.tar.gz
bugzilla-958e1a758168b4908bcdd237518ab85b93d7e1bb.tar.xz
Bug 519858 - Move uncommonly used parameters out of the "Required" section and into a "General" and "Advanced" section
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Config.pm19
-rw-r--r--Bugzilla/Config/Advanced.pm51
-rw-r--r--Bugzilla/Config/Core.pm68
-rw-r--r--Bugzilla/Config/General.pm82
-rw-r--r--Bugzilla/Install.pm7
-rw-r--r--Bugzilla/Install/Filesystem.pm45
6 files changed, 183 insertions, 89 deletions
diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm
index ceb1861ed..0361592bf 100644
--- a/Bugzilla/Config.pm
+++ b/Bugzilla/Config.pm
@@ -35,6 +35,7 @@ use strict;
use base qw(Exporter);
use Bugzilla::Constants;
use Bugzilla::Hook;
+use Bugzilla::Install::Filesystem qw(fix_file_permissions);
use Data::Dumper;
use File::Temp;
@@ -297,29 +298,13 @@ sub write_params {
rename $tmpname, $param_file
or die "Can't rename $tmpname to $param_file: $!";
- ChmodDataFile($param_file, 0666);
+ fix_file_permissions($param_file);
# And now we have to reset the params cache so that Bugzilla will re-read
# them.
delete Bugzilla->request_cache->{params};
}
-# Some files in the data directory must be world readable if and only if
-# we don't have a webserver group. Call this function to do this.
-# This will become a private function once all the datafile handling stuff
-# moves into this package
-
-# This sub is not perldoc'd for that reason - noone should know about it
-sub ChmodDataFile {
- my ($file, $mask) = @_;
- my $perm = 0770;
- if ((stat(bz_locations()->{'datadir'}))[2] & 0002) {
- $perm = 0777;
- }
- $perm = $perm & $mask;
- chmod $perm,$file;
-}
-
sub read_param_file {
my %params;
my $datadir = bz_locations()->{'datadir'};
diff --git a/Bugzilla/Config/Advanced.pm b/Bugzilla/Config/Advanced.pm
new file mode 100644
index 000000000..51943f03f
--- /dev/null
+++ b/Bugzilla/Config/Advanced.pm
@@ -0,0 +1,51 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+#
+# The Initial Developer of the Original Code is Netscape Communications
+# Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s): Terry Weissman <terry@mozilla.org>
+# Dawn Endico <endico@mozilla.org>
+# Dan Mosedale <dmose@mozilla.org>
+# Joe Robins <jmrobins@tgix.com>
+# Jacob Steenhagen <jake@bugzilla.org>
+# J. Paul Reed <preed@sigkill.com>
+# Bradley Baetz <bbaetz@student.usyd.edu.au>
+# Joseph Heenan <joseph@heenan.me.uk>
+# Erik Stambaugh <erik@dasbistro.com>
+# Frédéric Buclin <LpSolit@gmail.com>
+# Max Kanat-Alexander <mkanat@bugzilla.org>
+
+package Bugzilla::Config::Advanced;
+use strict;
+
+our $sortkey = 1700;
+
+use constant get_param_list => (
+ {
+ name => 'cookiedomain',
+ type => 't',
+ default => ''
+ },
+
+ {
+ name => 'proxy_url',
+ type => 't',
+ default => ''
+ },
+);
+
+1;
diff --git a/Bugzilla/Config/Core.pm b/Bugzilla/Config/Core.pm
index 550875e35..1548dcd9c 100644
--- a/Bugzilla/Config/Core.pm
+++ b/Bugzilla/Config/Core.pm
@@ -37,16 +37,7 @@ use Bugzilla::Config::Common;
our $sortkey = 100;
-sub get_param_list {
- my $class = shift;
- my @param_list = (
- {
- name => 'maintainer',
- type => 't',
- default => 'please.set.the.maintainer.parameter@administration.parameters',
- checker => \&check_email,
- },
-
+use constant get_param_list => (
{
name => 'urlbase',
type => 't',
@@ -55,30 +46,16 @@ sub get_param_list {
},
{
- name => 'docs_urlbase',
- type => 't',
- default => 'docs/%lang%/html/',
- checker => \&check_url
- },
-
- {
- name => 'sslbase',
- type => 't',
- default => '',
- checker => \&check_sslbase
- },
-
- {
name => 'ssl_redirect',
type => 'b',
default => 0
},
-
{
- name => 'cookiedomain',
+ name => 'sslbase',
type => 't',
- default => ''
+ default => '',
+ checker => \&check_sslbase
},
{
@@ -86,41 +63,6 @@ sub get_param_list {
type => 't',
default => '/'
},
-
- {
- name => 'utf8',
- type => 'b',
- default => '0',
- checker => \&check_utf8
- },
-
- {
- name => 'shutdownhtml',
- type => 'l',
- default => ''
- },
-
- {
- name => 'announcehtml',
- type => 'l',
- default => ''
- },
-
- {
- name => 'proxy_url',
- type => 't',
- default => ''
- },
-
- {
- name => 'upgrade_notification',
- type => 's',
- choices => ['development_snapshot', 'latest_stable_release',
- 'stable_branch_release', 'disabled'],
- default => 'latest_stable_release',
- checker => \&check_notification
- } );
- return @param_list;
-}
+);
1;
diff --git a/Bugzilla/Config/General.pm b/Bugzilla/Config/General.pm
new file mode 100644
index 000000000..3a6b827ed
--- /dev/null
+++ b/Bugzilla/Config/General.pm
@@ -0,0 +1,82 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+#
+# The Initial Developer of the Original Code is Netscape Communications
+# Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s): Terry Weissman <terry@mozilla.org>
+# Dawn Endico <endico@mozilla.org>
+# Dan Mosedale <dmose@mozilla.org>
+# Joe Robins <jmrobins@tgix.com>
+# Jacob Steenhagen <jake@bugzilla.org>
+# J. Paul Reed <preed@sigkill.com>
+# Bradley Baetz <bbaetz@student.usyd.edu.au>
+# Joseph Heenan <joseph@heenan.me.uk>
+# Erik Stambaugh <erik@dasbistro.com>
+# Frédéric Buclin <LpSolit@gmail.com>
+# Max Kanat-Alexander <mkanat@bugzilla.org>
+
+package Bugzilla::Config::General;
+use strict;
+use Bugzilla::Config::Common;
+
+our $sortkey = 150;
+
+use constant get_param_list => (
+ {
+ name => 'maintainer',
+ type => 't',
+ default => '',
+ checker => \&check_email
+ },
+
+ {
+ name => 'docs_urlbase',
+ type => 't',
+ default => 'docs/%lang%/html/',
+ checker => \&check_url
+ },
+
+ {
+ name => 'utf8',
+ type => 'b',
+ default => '0',
+ checker => \&check_utf8
+ },
+
+ {
+ name => 'shutdownhtml',
+ type => 'l',
+ default => ''
+ },
+
+ {
+ name => 'announcehtml',
+ type => 'l',
+ default => ''
+ },
+
+ {
+ name => 'upgrade_notification',
+ type => 's',
+ choices => ['development_snapshot', 'latest_stable_release',
+ 'stable_branch_release', 'disabled'],
+ default => 'latest_stable_release',
+ checker => \&check_notification
+ },
+);
+
+1;
diff --git a/Bugzilla/Install.pm b/Bugzilla/Install.pm
index a32063ca7..10804ab70 100644
--- a/Bugzilla/Install.pm
+++ b/Bugzilla/Install.pm
@@ -27,6 +27,7 @@ package Bugzilla::Install;
use strict;
use Bugzilla::Component;
+use Bugzilla::Config qw(:admin);
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Group;
@@ -310,6 +311,12 @@ sub make_admin {
$group_insert->execute($user->id, $editusers->id, 0, GRANT_DIRECT);
};
+ # If there is no maintainer set, make this user the maintainer.
+ if (!Bugzilla->params->{'maintainer'}) {
+ SetParam('maintainer', $user->email);
+ write_params();
+ }
+
print "\n", get_text('install_admin_created', { user => $user }), "\n";
}
diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm
index 2a000acae..c95b2eecb 100644
--- a/Bugzilla/Install/Filesystem.pm
+++ b/Bugzilla/Install/Filesystem.pm
@@ -45,6 +45,7 @@ our @EXPORT = qw(
update_filesystem
create_htaccess
fix_all_file_permissions
+ fix_file_permissions
);
# This looks like a constant because it effectively is, but
@@ -562,12 +563,20 @@ sub _update_old_charts {
}
}
+sub fix_file_permissions {
+ my ($file) = @_;
+ return if ON_WINDOWS;
+ my $perms = FILESYSTEM()->{all_files}->{$file}->{perms};
+ # Note that _get_owner_and_group is always silent here.
+ my ($owner_id, $group_id) = _get_owner_and_group();
+ _fix_perms($file, $owner_id, $group_id, $perms);
+}
sub fix_all_file_permissions {
my ($output) = @_;
- my $ws_group = Bugzilla->localconfig->{'webservergroup'};
- my $group_id = _check_web_server_group($ws_group, $output);
+ # _get_owner_and_group also checks that the webservergroup is valid.
+ my ($owner_id, $group_id) = _get_owner_and_group($output);
return if ON_WINDOWS;
@@ -578,9 +587,6 @@ sub fix_all_file_permissions {
print get_text('install_file_perms_fix') . "\n" if $output;
- my $owner_id = POSIX::getuid();
- $group_id = POSIX::getgid() unless defined $group_id;
-
foreach my $dir (sort keys %dirs) {
next unless -d $dir;
_fix_perms($dir, $owner_id, $group_id, $dirs{$dir});
@@ -617,6 +623,16 @@ sub fix_all_file_permissions {
_fix_cvs_dirs($owner_id, '.');
}
+sub _get_owner_and_group {
+ my ($output) = @_;
+ my $group_id = _check_web_server_group($output);
+ return () if ON_WINDOWS;
+
+ my $owner_id = POSIX::getuid();
+ $group_id = POSIX::getgid() unless defined $group_id;
+ return ($owner_id, $group_id);
+}
+
# A helper for fix_all_file_permissions
sub _fix_cvs_dirs {
my ($owner_id, $dir) = @_;
@@ -633,17 +649,22 @@ sub _fix_cvs_dirs {
sub _fix_perms {
my ($name, $owner, $group, $perms) = @_;
#printf ("Changing $name to %o\n", $perms);
- chown $owner, $group, $name
- or warn install_string('chown_failed', { path => $name,
- error => $! }) . "\n";
+
+ # The webserver should never try to chown files.
+ if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) {
+ chown $owner, $group, $name
+ or warn install_string('chown_failed', { path => $name,
+ error => $! }) . "\n";
+ }
chmod $perms, $name
or warn install_string('chmod_failed', { path => $name,
error => $! }) . "\n";
}
sub _check_web_server_group {
- my ($group, $output) = @_;
+ my ($output) = @_;
+ my $group = Bugzilla->localconfig->{'webservergroup'};
my $filename = bz_locations()->{'localconfig'};
my $group_id;
@@ -727,4 +748,10 @@ Params: C<$output> - C<true> if you want this function to print
Returns: nothing
+=item C<fix_file_permissions>
+
+Given the name of a file, its permissions will be fixed according to
+how they are supposed to be set in Bugzilla's current configuration.
+If it fails to set the permissions, a warning will be printed to STDERR.
+
=back