Commit 958e1a75 authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 519858 - Move uncommonly used parameters out of the "Required" section and…

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
parent 26f91288
......@@ -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'};
......
# -*- 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;
......@@ -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;
# -*- 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;
......@@ -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";
}
......
......@@ -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
[%# 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): Dave Miller <justdave@bugzilla.org>
# Frédéric Buclin <LpSolit@gmail.com>
#%]
[%
title = "Advanced"
desc = "Settings for advanced configurations."
%]
[% param_descs = {
cookiedomain =>
"If your website is at 'www.foo.com', setting this to"
_ " '.foo.com' will also allow 'bar.foo.com' to access"
_ " $terms.Bugzilla cookies. This is useful if you have more than"
_ " one hostname pointing at the same web server, and you"
_ " want them to share the $terms.Bugzilla cookie.",
proxy_url =>
"$terms.Bugzilla may have to access the web to get notifications about"
_ " new releases (see the <tt>upgrade_notification</tt> parameter)."
_ " If your $terms.Bugzilla server is behind a proxy, it may be"
_ " necessary to enter its URL if the web server cannot access the"
_ " HTTP_PROXY environment variable. If you have to authenticate,"
_ " use the <code>http://user:pass@proxy_url/</code> syntax.",
} %]
......@@ -25,20 +25,9 @@
%]
[% param_descs = {
maintainer => "The email address of the person who maintains this installation " _
"of ${terms.Bugzilla}.",
urlbase => "The URL that is the common initial leading part of all $terms.Bugzilla " _
"URLs.",
docs_urlbase => "The URL that is the common initial leading part of all " _
"$terms.Bugzilla documentation URLs. " _
"It may be an absolute URL, or a URL relative to urlbase " _
"above. " _
"Leave this empty to suppress links to the documentation." _
"'%lang%' will be replaced by user's preferred language " _
"(if available).",
sslbase => "The URL that is the common initial leading part of all HTTPS " _
"(SSL) $terms.Bugzilla URLs.",
......@@ -49,13 +38,6 @@
_ " $terms.Bugzilla will send out links using <tt>sslbase</tt> in emails"
_ " instead of <tt>urlbase</tt>.",
cookiedomain => "The domain for $terms.Bugzilla cookies. Normally blank. " _
"If your website is at 'www.foo.com', setting this to " _
"'.foo.com' will also allow 'bar.foo.com' to access " _
"$terms.Bugzilla cookies. This is useful if you have more than " _
"one hostname pointing at the same web server, and you " _
"want them to share the $terms.Bugzilla cookie.",
cookiepath => "Path, relative to your web document root, to which to restrict " _
"$terms.Bugzilla cookies. Normally this is the URI portion of your URL " _
"base. Begin with a / (single slash mark). For instance, if " _
......@@ -63,52 +45,4 @@
"this parameter to /bugzilla/. Setting it to / will allow " _
"all sites served by this web server or virtual host to read " _
"$terms.Bugzilla cookies.",
utf8 => "Use UTF-8 (Unicode) encoding for all text in ${terms.Bugzilla}. New " _
"installations should set this to true to avoid character encoding " _
"problems. <strong>Existing databases should set this to true " _
" only after the data has been converted from existing legacy " _
" character encodings to UTF-8, using the " _
" <kbd>contrib/recode.pl</kbd> script</strong>. <br><br> Note " _
" that if you turn this parameter from &quot;off&quot; to " _
" &quot;on&quot;, you must re-run checksetup.pl immediately " _
" afterward.",
shutdownhtml => "If this field is non-empty, then $terms.Bugzilla will be completely " _
"disabled and this text will be displayed instead of all the " _
"$terms.Bugzilla pages.",
announcehtml => "If this field is non-empty, then $terms.Bugzilla will " _
"display whatever is in this field at the top of every " _
"HTML page. The HTML you put in this field is not " _
"wrapped or enclosed in anything; you might want to " _
"wrap it inside a <tt>&lt;div&gt;</tt>. Give the div " _
"<em>id=message</em> to get green text inside a " _
"red box, or <em>class=bz_private</em> for dark " _
"red on a red background. Anything defined in " _
"<tt>skins/standard/global.css</tt> or " _
"<tt>skins/custom/global.css</tt> will work. To get " _
"centered text, use <em>style=\"text-align: " _
"center;\"</em>.",
proxy_url => "$terms.Bugzilla may have to access the web to get notifications about new " _
"releases, see the <tt>upgrade_notification</tt> parameter. In case you are " _
"behind a proxy, it may be necessary to enter its URL if the web server " _
"group cannot access the HTTP_PROXY environment variable. If you have to " _
"authenticate, use the <code>http://user:pass@proxy_url/</code> syntax.",
upgrade_notification => "<p>$terms.Bugzilla can inform you when a new release is available. " _
"The notification will appear on the $terms.Bugzilla homepage, " _
"for administrators only.</p>" _
"<ul><li>'development_snapshot' notifies you about the latest " _
"release on the trunk, i.e. development snapshots.</li>" _
"<li>'latest_stable_release' notifies you about the most recent release " _
"available on the most recent stable branch. This branch may be " _
"different from the branch your installation is based on.</li>" _
"<li>'stable_branch_release' notifies you only about new releases " _
"corresponding to the branch your installation is based on. " _
"If you are running a release candidate, you will get " _
"a notification for newer release candidates too.</li>" _
"<li>'disabled' will never notify you about new releases and no " _
"connection will be established to a remote server.</li></ul>" }
%]
} %]
[%# 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): Dave Miller <justdave@bugzilla.org>
# Frédéric Buclin <LpSolit@gmail.com>
#%]
[%
title = "General"
desc = "Miscellaneous general settings that are not required."
%]
[% param_descs = {
maintainer =>
"The email address of the person who maintains this installation "
_ " of ${terms.Bugzilla}.",
docs_urlbase =>
"The URL that is the common initial leading part of all"
_ " $terms.Bugzilla documentation URLs. It may be an absolute URL,"
_ " or a URL relative to the <tt>urlbase</tt> parameter. Leave this"
_ " empty to suppress links to the documentation."
_ "'%lang%' will be replaced by user's preferred language (if"
_ " documentation is available in that language).",
utf8 =>
"Use UTF-8 (Unicode) encoding for all text in ${terms.Bugzilla}. New"
_ " installations should set this to true to avoid character encoding"
_ " problems. <strong>Existing databases should set this to true"
_ " only after the data has been converted from existing legacy"
_ " character encodings to UTF-8, using the <kbd>contrib/recode.pl</kbd>"
_ " script</strong>."
_ " <p>Note that if you turn this parameter from &quot;off&quot; to"
_ " &quot;on&quot;, you must re-run checksetup.pl immediately"
_ " afterward.</p>",
shutdownhtml =>
"If this field is non-empty, then $terms.Bugzilla will be completely"
_ " disabled and this text will be displayed instead of all the"
_ " $terms.Bugzilla pages.",
announcehtml =>
"If this field is non-empty, then $terms.Bugzilla will"
_ " display whatever is in this field at the top of every"
_ " HTML page. The HTML you put in this field is not wrapped or"
_ " enclosed in anything. You might want to wrap it inside a"
_ "<tt>&lt;div&gt;</tt>. Give the div <em>id=\"message\"</em> to get"
_ " green text inside a red box, or <em>class=\"bz_private\"</em> for"
_ " dark red on a red background. Anything defined in "
_ " <tt>skins/standard/global.css</tt> or <tt>skins/custom/global.css</tt>"
_ " will work. To get centered text, use <em>style=\"text-align: "
_ " center;\"</em>.",
upgrade_notification =>
"$terms.Bugzilla can inform you when a new release is available."
_ " The notification will appear on the $terms.Bugzilla homepage,"
_ " for administrators only."
_ " <ul><li>'development_snapshot' notifies you about the development "
_ " snapshot that has been released.</li>"
_ " <li>'latest_stable_release' notifies you about the most recent"
_ " release available on the most recent stable branch. This branch"
_ " may be different from the branch your installation is based on.</li>"
_ " <li>'stable_branch_release' notifies you only about new releases"
_ " corresponding to the branch your installation is based on."
_ " If you are running a release candidate, you will get a notification"
_ " for newer release candidates too.</li>"
_ " <li>'disabled' will never notify you about new releases and no"
_ " connection will be established to a remote server.</li></ul>"
_ " <p>Note that if your $terms.Bugzilla server requires a proxy to"
_ " access the Internet, you may also need to set the <tt>proxy_url</tt>"
_ " parameter in the Advanced section.</p>",
} %]
......@@ -96,7 +96,7 @@ YAHOO.util.Event.onDOMReady(onLoadActions);
<p class="notice">This message is only shown to logged in users with admin privs.
You can configure this notification from the
<a href="editparams.cgi?section=core#upgrade_notification">Parameters</a> page.</p>
<a href="editparams.cgi?section=general#upgrade_notification">Parameters</a> page.</p>
[% ELSIF release.error == "cannot_download" %]
<p>The local XML file '[% release.xml_file FILTER html %]' cannot be created.
Please make sure the web server can write in this directory and that you can access
......
......@@ -41,9 +41,6 @@
parameters for this installation; among others:</p>
<ul>
<li><a href="editparams.cgi?section=core#maintainer">maintainer</a>, the person
responsible for this installation if something is running wrong.</li>
<li><a href="editparams.cgi?section=core#urlbase">urlbase</a>, which is the URL
pointing to this installation and which will be used in emails (which is also the
reason you see this page: as long as this parameter is not set, you will see this
......@@ -52,9 +49,9 @@
<li><a href="editparams.cgi?section=core#cookiepath">cookiepath</a> is important
for your browser to manage your cookies correctly.</li>
<li><a href="editparams.cgi?section=core#utf8">utf8</a> will let you encode all
texts into UTF-8, if desired (it is strongly recommended to keep this parameter
turned on).</li>
<li><a href="editparams.cgi?section=general#maintainer">maintainer</a>,
the person responsible for this installation if something is
running wrongly.</li>
</ul>
<p>Also important are the following parameters:</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment