#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
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;