Bugzilla – Attachment 109949 Details for
Bug 26290
Add the ability to set a default SMTP server in koha-conf.xml
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26290: Make Makefile.PL aware of SMTP configs
Bug-26290-Make-MakefilePL-aware-of-SMTP-configs.patch (text/plain), 7.68 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-09-11 14:29:32 UTC
(
hide
)
Description:
Bug 26290: Make Makefile.PL aware of SMTP configs
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-09-11 14:29:32 UTC
Size:
7.68 KB
patch
obsolete
>From 9b49c93a026e05308cb3ecc37d565737fc1d1b86 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 11 Sep 2020 11:27:17 -0300 >Subject: [PATCH] Bug 26290: Make Makefile.PL aware of SMTP configs > >--- > Makefile.PL | 99 +++++++++++++++++++++++++++++++++++++++++++++-- > etc/koha-conf.xml | 14 +++---- > rewrite-config.PL | 9 ++++- > 3 files changed, 111 insertions(+), 11 deletions(-) > >diff --git a/Makefile.PL b/Makefile.PL >index 7d5a2306a9..90d52256c6 100644 >--- a/Makefile.PL >+++ b/Makefile.PL >@@ -471,6 +471,34 @@ System user account that will own Koha's files. > > System group that will own Koha's files. > >+=item SMTP_HOST >+ >+SMTP server host name (default: localhost) >+ >+=item SMTP_PORT >+ >+SMTP server port (default: 25) >+ >+=item SMTP_TIMEOUT >+ >+Connection timeour in seconds (default: 120) >+ >+=item SMTP_SSL_MODE >+ >+SSL mode. Options are 'disabled' (default), 'ssl' and 'starttls' >+ >+=item SMTP_USER_NAME >+ >+SMTP authentication user name >+ >+=item SMTP_PASSWORD >+ >+SMTP authentication password >+ >+=item SMTP_DEBUG >+ >+Enable debug mode for SMTP (default: no) >+ > =back > > =cut >@@ -511,7 +539,14 @@ my %config_defaults = ( > 'USE_ELASTICSEARCH' => 'no', > 'ELASTICSEARCH_SERVERS' => 'localhost:9200', > 'ELASTICSEARCH_INDEX' => 'koha', >- 'FONT_DIR' => '/usr/share/fonts/truetype/dejavu' >+ 'FONT_DIR' => '/usr/share/fonts/truetype/dejavu', >+ 'SMTP_HOST' => 'localhost', >+ 'SMTP_PORT' => '25', >+ 'SMTP_TIMEOUT' => '120', >+ 'SMTP_SSL_MODE' => 'disabled', >+ 'SMTP_USER_NAME' => '', >+ 'SMTP_PASSWORD' => '', >+ 'SMTP_DEBUG' => 'no', > ); > > # set some default configuration options based on OS >@@ -542,6 +577,8 @@ my %valid_config_values = ( > 'RUN_DATABASE_TESTS' => { 'yes' => 1, 'no' => 1 }, > 'USE_MEMCACHED' => { 'yes' => 1, 'no' => 1 }, > 'USE_ELASTICSEARCH' => { 'yes' => 1, 'no' => 1 }, >+ 'SMTP_SSL_MODE' => { 'disabled' => 1, 'ssl' => 1, 'starttls' => 1 }, >+ 'SMTP_DEBUG' => { 'yes' => 1, 'no' => 1 }, > ); > > # get settings from command-line >@@ -570,6 +607,14 @@ my $cli_koha_font_dir = ""; > my $cli_koha_run_database_tests = ""; > my $cli_koha_install_base = ""; > my $cli_koha_template_cache_dir = ""; >+my $cli_smtp_host = ""; >+my $cli_smtp_port = ""; >+my $cli_smtp_timeout = ""; >+my $cli_smtp_ssl_mode = ""; >+my $cli_smtp_user_name = ""; >+my $cli_smtp_password = ""; >+my $cli_smtp_debug = ""; >+ > Getopt::Long::Configure('pass_through'); > my $results = GetOptions( > "prev-install-log=s" => \$koha_install_log, >@@ -597,6 +642,13 @@ my $results = GetOptions( > "run_database_tests=s" => \$cli_koha_run_database_tests, > "install_base=s" => \$cli_koha_install_base, > "template-cache-dir=s" => \$cli_koha_template_cache_dir, >+ "smtp-host=s" => \$cli_smtp_host, >+ "smtp-port=s" => \$cli_smtp_port, >+ "smtp-timeout=s" => \$cli_smtp_timeout, >+ "smtp-ssl-mode=s" => \$cli_smtp_ssl_mode, >+ "smtp-user-name=s" => \$cli_smtp_user_name, >+ "smtp-password=s" => \$cli_smtp_password, >+ "smtp-debug" => \$cli_smtp_debug, > "help" => sub { HelpMessage(0) }, > ) or HelpMessage(1); > >@@ -685,7 +737,7 @@ WriteMakefile( > #VERSION => strftime('2.9.%Y%m%d%H',gmtime), > VERSION_FROM => 'kohaversion.pl', > ABSTRACT => 'Award-winning integrated library system (ILS) and Web OPAC', >- AUTHOR => 'Koha Contributors <http://koha-community.org/>', >+ AUTHOR => 'Koha Contributors <https://koha-community.org/>', > NO_META => 1, > PREREQ_PM => $koha_pm->prereq_pm, > >@@ -872,7 +924,14 @@ sub get_cli_values { > FONT_DIR => $cli_koha_font_dir, > RUN_DATABASE_TESTS => $cli_koha_run_database_tests, > INSTALL_BASE => $cli_koha_install_base, >- TEMPLATE_CACHE_DIR => $cli_koha_template_cache_dir >+ TEMPLATE_CACHE_DIR => $cli_koha_template_cache_dir, >+ SMTP_HOST => $cli_smtp_host, >+ SMTP_PORT => $cli_smtp_port, >+ SMTP_TIMEOUT => $cli_smtp_timeout, >+ SMTP_SSL_MODE => $cli_smtp_ssl_mode, >+ SMTP_USER_NAME => $cli_smtp_user_name, >+ SMTP_PASSWORD => $cli_smtp_password, >+ SMTP_DEBUG => (defined $cli_smtp_debug) ? ( $cli_smtp_debug ? 'yes' : 'no' ) : $values->{SMTP_DEBUG}, > }; > foreach my $key (keys %{$map}) { > $values->{$key} = $map->{$key} if ($map->{$key}); >@@ -1256,6 +1315,40 @@ Template cache directory?); > Path to DejaVu fonts?); > $config{'FONT_DIR'} = _get_value('FONT_DIR', $msg, $defaults->{'FONT_DIR'}, $valid_values, $install_log_values); > >+ $msg = q( >+SMTP settings >+You will be able to set your default SMTP configuration.); >+ $msg .= q{ >+SMTP host name?}; >+ $config{'SMTP_HOST'} = _get_value('SMTP_HOST', $msg, $defaults->{'SMTP_HOST'}, $valid_values, $install_log_values); >+ >+ $msg = q{ >+SMTP port?}; >+ $config{'SMTP_PORT'} = _get_value('SMTP_PORT', $msg, $defaults->{'SMTP_PORT'}, $valid_values, $install_log_values); >+ >+ $msg = q{ >+SMTP timeout (in seconds)?}; >+ $config{'SMTP_TIMEOUT'} = _get_value('SMTP_TIMEOUT', $msg, $defaults->{'SMTP_TIMEOUT'}, $valid_values, $install_log_values); >+ >+ $msg = q{ >+SMTP SSL mode?}; >+ $msg .= _add_valid_values_disp('SMTP_SSL_MODE', $valid_values); >+ $config{'SMTP_SSL_MODE'} = _get_value('SMTP_SSL_MODE', $msg, $defaults->{'SMTP_SSL_MODE'}, $valid_values, $install_log_values); >+ >+ $msg = q{ >+SMTP user name?}; >+ $config{'SMTP_USER_NAME'} = _get_value('SMTP_USER_NAME', $msg, $defaults->{'SMTP_USER_NAME'}, $valid_values, $install_log_values); >+ >+ $msg = q{ >+SMTP password?}; >+ $config{'SMTP_PASSWORD'} = _get_value('SMTP_PASSWORD', $msg, $defaults->{'SMTP_PASSWORD'}, $valid_values, $install_log_values); >+ >+ $msg = q{ >+SMTP debug mode?}; >+ $msg .= _add_valid_values_disp('SMTP_DEBUG', $valid_values); >+ $config{'SMTP_DEBUG'} = _get_value('SMTP_DEBUG', $msg, $defaults->{'SMTP_DEBUG'}, $valid_values, $install_log_values); >+ >+ $config{'SMTP_DEBUG'} = ( $config{'SMTP_DEBUG'} eq 'yes' ) ? 1 : 0; > > $msg = q( > Would you like to run the database-dependent test suite?); >diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml >index 54fbbdab08..eff50d2bcd 100644 >--- a/etc/koha-conf.xml >+++ b/etc/koha-conf.xml >@@ -261,13 +261,13 @@ __PAZPAR2_TOGGLE_XML_POST__ > </koha_xslt_security> > > <smtp_server> >- <host>localhost</host> >- <port>25</port> >- <timeout>120</timeout> >- <ssl_mode>disabled</ssl_mode> >- <user_name></user_name> >- <password></password> >- <debug>0</debug> >+ <host>__SMTP_HOST__</host> >+ <port>__SMTP_PORT__</port> >+ <timeout>__SMTP_TIMEOUT__</timeout> >+ <ssl_mode>__SMTP_SSL_MODE__</ssl_mode> >+ <user_name>__SMTP_USER_NAME__</user_name> >+ <password>__SMTP_PASSWORD__</password> >+ <debug>__SMTP_DEBUG__</debug> > </smtp_server> > > </config> >diff --git a/rewrite-config.PL b/rewrite-config.PL >index 8479e12faf..a7d4088b33 100644 >--- a/rewrite-config.PL >+++ b/rewrite-config.PL >@@ -158,7 +158,14 @@ my %configuration = ( > "__ELASTICSEARCH_SERVERS__" => "localhost:9200", > "__ELASTICSEARCH_INDEX__" => "koha", > "__FONT_DIR__" => "/usr/share/fonts/truetype/dejavu", >- "__TEMPLATE_CACHE_DIR__" => "/tmp/koha" >+ "__TEMPLATE_CACHE_DIR__" => "/tmp/koha", >+ '__SMTP_HOST__' => 'localhost', >+ '__SMTP_PORT__' => '25', >+ '__SMTP_TIMEOUT__' => '120', >+ '__SMTP_SSL_MODE__' => 'disabled', >+ '__SMTP_USER_NAME__' => '', >+ '__SMTP_PASSWORD__' => '', >+ '__SMTP_DEBUG__' => '0', > ); > > # Override configuration from the environment >-- >2.28.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26290
:
109035
|
109036
|
109617
|
109618
|
109949
|
110758
|
110759
|
110760
|
111141