# BEGIN BPS TAGGED BLOCK {{{
-#
+#
# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-# <jesse@bestpractical.com>
-#
+#
+# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
+# <sales@bestpractical.com>
+#
# (Except where explicitly superseded by other copyright notices)
-#
-#
+#
+#
# LICENSE:
-#
+#
# This work is made available to you under the terms of Version 2 of
# the GNU General Public License. A copy of that license should have
# been provided with this software, but in any event can be snarfed
# from www.gnu.org.
-#
+#
# This work is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 or visit their web page on the internet at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
+#
+#
# CONTRIBUTION SUBMISSION POLICY:
-#
+#
# (The following paragraph is not intended to limit the rights granted
# to you to modify and distribute this software under the terms of
# the GNU General Public License and is only of importance to you if
# you choose to contribute your changes and enhancements to the
# community by submitting them to Best Practical Solutions, LLC.)
-#
+#
# By intentionally submitting any modifications, corrections or
# derivatives to this work, or any other work intended for use with
# Request Tracker, to Best Practical Solutions, LLC, you confirm that
# royalty-free, perpetual, license to use, copy, create derivative
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
-#
+#
# END BPS TAGGED BLOCK }}}
package RT::Installer;
use strict;
use warnings;
+use DateTime;
+
require UNIVERSAL::require;
my %Meta = (
DatabaseType => {
},
},
DatabaseAdmin => {
+ SkipWrite => 1,
Widget => '/Widgets/Form/String',
WidgetArguments => {
Default => 1,
},
},
DatabaseAdminPassword => {
+ SkipWrite => 1,
Widget => '/Widgets/Form/String',
WidgetArguments => {
Description => 'DBA password', #loc
Hints => 'The password RT should use to connect to the database.',
},
},
- DatabaseRequireSSL => {
- Widget => '/Widgets/Form/Boolean',
- WidgetArguments => {
- Description => 'Use SSL?', # loc
- },
- },
rtname => {
Widget => '/Widgets/Form/String',
WidgetArguments => {
},
},
Password => {
+ SkipWrite => 1,
Widget => '/Widgets/Form/String',
WidgetArguments => {
Description => 'Administrative password', #loc
Description => 'Path to sendmail', #loc
},
},
- WebDomain => {
- Widget => '/Widgets/Form/String',
- WidgetArguments => {
- Description => 'Domain name', #loc
- Hints => "Don't include http://, just something like 'localhost', 'rt.example.com'", #loc
- },
- },
- WebPort => {
- Widget => '/Widgets/Form/Integer',
- WidgetArguments => {
- Description => 'Web port', #loc
- Hints => 'which port your web server will listen to, e.g. 8080', #loc
- },
- },
-
-);
-
-my $HAS_DATETIME_TZ = eval { require DateTime::TimeZone };
-
-if ($HAS_DATETIME_TZ) {
- $Meta{Timezone} = {
+ Timezone => {
Widget => '/Widgets/Form/Select',
WidgetArguments => {
Description => 'Timezone', #loc
my $ret;
$ret->{Values} = ['', DateTime::TimeZone->all_names];
- my $has_datetime = eval { require DateTime };
- if ( $has_datetime ) {
- my $dt = DateTime->now;
- for my $tz ( DateTime::TimeZone->all_names ) {
- $dt->set_time_zone( $tz );
- $ret->{ValuesLabel}{$tz} =
- $tz . ' ' . $dt->strftime('%z');
- }
+ my $dt = DateTime->now;
+ for my $tz ( DateTime::TimeZone->all_names ) {
+ $dt->set_time_zone( $tz );
+ $ret->{ValuesLabel}{$tz} =
+ $tz . ' ' . $dt->strftime('%z');
}
$ret->{ValuesLabel}{''} = 'System Default'; #loc
return $ret;
},
},
- };
-}
-else {
- $Meta{Timezone} = {
+ },
+ WebDomain => {
Widget => '/Widgets/Form/String',
WidgetArguments => {
- Description => 'Timezone', #loc
+ Description => 'Domain name', #loc
+ Hints => "Don't include http://, just something like 'localhost', 'rt.example.com'", #loc
},
- };
-}
+ },
+ WebPort => {
+ Widget => '/Widgets/Form/Integer',
+ WidgetArguments => {
+ Description => 'Web port', #loc
+ Hints => 'which port your web server will listen to, e.g. 8080', #loc
+ },
+ },
+
+);
sub Meta {
my $class = shift;
sub ConfigFile {
require File::Spec;
- return File::Spec->catfile( $RT::EtcPath, 'RT_SiteConfig.pm' );
+ return $ENV{RT_SITE_CONFIG} || File::Spec->catfile( $RT::EtcPath, 'RT_SiteConfig.pm' );
}
sub SaveConfig {
{
local $/;
- open my $fh, '<', $file or die $!;
+ open( my $fh, '<', $file ) or die $!;
$content = <$fh>;
$content =~ s/^\s*1;\s*$//m;
}
$RT::Installer->{InstallConfig}{rtname};
if ( open my $fh, '>', $file ) {
- for ( keys %{ $RT::Installer->{InstallConfig} } ) {
+ for ( sort keys %{ $RT::Installer->{InstallConfig} } ) {
# we don't want to store root's password in config.
- next if $_ eq 'Password';
+ next if $class->Meta($_) and $class->Meta($_)->{SkipWrite};
$RT::Installer->{InstallConfig}{$_} = ''
unless defined $RT::Installer->{InstallConfig}{$_};
# remove obsolete settings we'll add later
$content =~ s/^\s* Set \s* \( \s* \$$_ .*$//xm;
- $content .= "Set( \$$_, '$RT::Installer->{InstallConfig}{$_}' );\n";
+ my $value = $RT::Installer->{InstallConfig}{$_};
+ $value =~ s/(['\\])/\\$1/g;
+ $content .= "Set( \$$_, '$value' );\n";
}
$content .= "1;\n";
print $fh $content;
=cut
-eval "require RT::Installer_Vendor";
-if ($@ && $@ !~ qr{^Can't locate RT/Installer_Vendor.pm}) {
- die $@;
-};
-
-eval "require RT::Installer_Local";
-if ($@ && $@ !~ qr{^Can't locate RT/Installer_Local.pm}) {
- die $@;
-};
+RT::Base->_ImportOverlays();
1;