⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 localconfig.pm

📁 bugzilla
💻 PM
📖 第 1 页 / 共 2 页
字号:
# -*- 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 Initial Developer of the Original Code is Everything Solved.# Portions created by Everything Solved are Copyright (C) 2006# Everything Solved. All Rights Reserved.## The Original Code is the Bugzilla Bug Tracking System.## Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>package Bugzilla::Install::Localconfig;# NOTE: This package may "use" any modules that it likes. However,# all functions in this package should assume that:## * The data/ directory does not exist.# * Templates are not available.# * Files do not have the correct permissions# * The database is not up to dateuse strict;use Bugzilla::Constants;use Data::Dumper;use IO::File;use Safe;use base qw(Exporter);our @EXPORT_OK = qw(    read_localconfig    update_localconfig);use constant LOCALCONFIG_VARS => (    {        name    => 'create_htaccess',        default => 1,        desc    => <<EOT# If you are using Apache as your web server, Bugzilla can create .htaccess# files for you that will instruct Apache not to serve files that shouldn't# be accessed from the web (like your local configuration data and non-cgi# executable files).  For this to work, the directory your Bugzilla# installation is in must be within the jurisdiction of a <Directory> block# in the httpd.conf file that has 'AllowOverride Limit' in it.  If it has# 'AllowOverride All' or other options with Limit, that's fine.# (Older Apache installations may use an access.conf file to store these# <Directory> blocks.)# If this is set to 1, Bugzilla will create these files if they don't exist.# If this is set to 0, Bugzilla will not create these files.EOT    },    {        name    => 'webservergroup',        default => ON_WINDOWS ? '' : 'apache',        desc    => q{# This is the group your web server runs as.# If you have a Windows box, ignore this setting.# If you do not have access to the group your web server runs under,# set this to "". If you do set this to "", then your Bugzilla installation# will be _VERY_ insecure, because some files will be world readable/writable,# and so anyone who can get local access to your machine can do whatever they# want. You should only have this set to "" if this is a testing installation# and you cannot set this up any other way. YOU HAVE BEEN WARNED!# If you set this to anything other than "", you will need to run checksetup.pl# as} . ROOT_USER . qq{, or as a user who is a member of the specified group.\n}    },    {        name    => 'db_driver',        default => 'mysql',        desc    => <<EOT# What SQL database to use. Default is mysql. List of supported databases# can be obtained by listing Bugzilla/DB directory - every module corresponds# to one supported database and the name corresponds to a driver name.EOT    },    {        name    => 'db_host',        default => 'localhost',        desc    =>             "# The DNS name of the host that the database server runs on.\n"    },    {        name    => 'db_name',        default => 'bugs',        desc    => "# The name of the database\n"    },    {        name    => 'db_user',        default => 'bugs',        desc    => "# Who we connect to the database as.\n"    },    {        name    => 'db_pass',        default => '',        desc    => <<EOT# Enter your database password here. It's normally advisable to specify# a password for your bugzilla database user.# If you use apostrophe (') or a backslash (\\) in your password, you'll# need to escape it by preceding it with a '\\' character. (\\') or (\\)# (Far simpler just not to use those characters.)EOT    },    {        name    => 'db_port',        default => 0,        desc    => <<EOT# Sometimes the database server is running on a non-standard port. If that's# the case for your database server, set this to the port number that your# database server is running on. Setting this to 0 means "use the default# port for my database server."EOT    },    {        name    => 'db_sock',        default => '',        desc    => <<EOT# MySQL Only: Enter a path to the unix socket for MySQL. If this is# blank, then MySQL's compiled-in default will be used. You probably# want that.EOT    },    {        name    => 'db_check',        default => 1,        desc    => <<EOT# Should checksetup.pl try to verify that your database setup is correct?# (with some combinations of database servers/Perl modules/moonphase this# doesn't work)EOT    },    {        name    => 'index_html',        default => 0,        desc    => <<EOT# With the introduction of a configurable index page using the# template toolkit, Bugzilla's main index page is now index.cgi.# Most web servers will allow you to use index.cgi as a directory# index, and many come preconfigured that way, but if yours doesn't# then you'll need an index.html file that provides redirection# to index.cgi. Setting \$index_html to 1 below will allow# checksetup.pl to create one for you if it doesn't exist.# NOTE: checksetup.pl will not replace an existing file, so if you#       wish to have checksetup.pl create one for you, you must#       make sure that index.html doesn't already existEOT    },    {        name    => 'cvsbin',        default => \&_get_default_cvsbin,        desc    => <<EOT# For some optional functions of Bugzilla (such as the pretty-print patch# viewer), we need the cvs binary to access files and revisions.# Because it's possible that this program is not in your path, you can specify# its location here.  Please specify the full path to the executable.EOT    },    {        name    => 'interdiffbin',        default => \&_get_default_interdiffbin,        desc    => <<EOT# For some optional functions of Bugzilla (such as the pretty-print patch# viewer), we need the interdiff binary to make diffs between two patches.# Because it's possible that this program is not in your path, you can specify# its location here.  Please specify the full path to the executable.EOT    },    {        name    => 'diffpath',        default => \&_get_default_diffpath,        desc    => <<EOT# The interdiff feature needs diff, so we have to have that path.# Please specify the directory name only; do not use trailing slash.EOT    },);use constant OLD_LOCALCONFIG_VARS => qw(    mysqlpath    contenttypes    pages    severities platforms opsys priorities);sub read_localconfig {    my ($include_deprecated) = @_;    my $filename = bz_locations()->{'localconfig'};    my %localconfig;    if (-e $filename) {        my $s = new Safe;        # Some people like to store their database password in another file.        $s->permit('dofile');        $s->rdo($filename);        if ($@ || $!) {            my $err_msg = $@ ? $@ : $!;            die <<EOT;An error has occurred while reading your 'localconfig' file.  The text of the error message is:$err_msgPlease fix the error in your 'localconfig' file. Alternately, rename your'localconfig' file, rerun checksetup.pl, and re-enter your answers.  \$ mv -f localconfig localconfig.old  \$ ./checksetup.plEOT        }        my @vars = map($_->{name}, LOCALCONFIG_VARS);        push(@vars, OLD_LOCALCONFIG_VARS) if $include_deprecated;        foreach my $var (@vars) {            my $glob = $s->varglob($var);            # We can't get the type of a variable out of a Safe automatically.            # We can only get the glob itself. So we figure out its type this            # way, by trying first a scalar, then an array, then a hash.            #            # The interesting thing is that this converts all deprecated             # array or hash vars into hashrefs or arrayrefs, but that's             # fine since as I write this all modern localconfig vars are             # actually scalars.            if (defined $$glob) {                $localconfig{$var} = $$glob;            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -