]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1437238 - Create override parameters for mailer configuration
authorDylan William Hardison <dylan@hardison.net>
Mon, 12 Mar 2018 21:02:09 +0000 (17:02 -0400)
committerGitHub <noreply@github.com>
Mon, 12 Mar 2018 21:02:09 +0000 (17:02 -0400)
Bugzilla/BugMail.pm
Bugzilla/Install/Localconfig.pm
Bugzilla/Mailer.pm
Bugzilla/Send/Sendmail.pm
README.rst
template/en/default/admin/admin.html.tmpl

index defe7c84f860e0462deef171bb9e356af34d4967..915405a0e09e132e6391c6dbc6131584e5184606 100644 (file)
@@ -421,7 +421,7 @@ sub sendMail {
         bugmailtype        => $bugmailtype,
     };
 
-    if (Bugzilla->params->{'use_mailer_queue'}) {
+    if (Bugzilla->get_param_with_override('use_mailer_queue')) {
         enqueue($vars);
     } else {
         MessageToMTA(_generate_bugmail($vars));
index ba8e8dc578850cca5f6a29b4090b9b3c7e2cdd8f..de2219f1652ea30cdeed673f92b55ea3e614ca9f 100644 (file)
@@ -43,7 +43,7 @@ our @EXPORT_OK = qw(
 
 # might want to change this for upstream
 use constant ENV_PREFIX     => 'BMO_';
-use constant PARAM_OVERRIDE => qw( shadowdb shadowdbhost shadowdbport shadowdbsock );
+use constant PARAM_OVERRIDE => qw( use_mailer_queue mail_delivery_method shadowdb shadowdbhost shadowdbport shadowdbsock );
 
 sub _sensible_group {
     return '' if ON_WINDOWS;
@@ -135,12 +135,12 @@ use constant LOCALCONFIG_VARS => (
     {
         name    => 'param_override',
         default => {
-            memcached_servers   => undef,
-            memcached_namespace => undef,
-            shadowdb            => undef,
-            shadowdbhost        => undef,
-            shadowdbport        => undef,
-            shadowdbsock        => undef,
+            use_mailer_queue     => undef,
+            mail_delivery_method => undef,
+            shadowdb             => undef,
+            shadowdbhost         => undef,
+            shadowdbport         => undef,
+            shadowdbsock         => undef,
         },
     },
     {
index 6e46d18629421d8aa4631e0535cfb605888c43f9..e245a05e0038366b6c2d2c66f1d406b9487783ff 100644 (file)
@@ -37,10 +37,10 @@ use Bugzilla::Version qw(vers_cmp);
 
 sub MessageToMTA {
     my ($msg, $send_now) = (@_);
-    my $method = Bugzilla->params->{'mail_delivery_method'};
+    my $method = Bugzilla->get_param_with_override('mail_delivery_method');
     return if $method eq 'None';
 
-    if (Bugzilla->params->{'use_mailer_queue'} and !$send_now) {
+    if (Bugzilla->get_param_with_override('use_mailer_queue') and !$send_now) {
         Bugzilla->job_queue->insert('send_mail', { msg => $msg });
         return;
     }
@@ -66,7 +66,7 @@ sub MessageToMTA {
     }
 
     # Ensure that we are not sending emails too quickly to recipients.
-    if (Bugzilla->params->{use_mailer_queue}
+    if (Bugzilla->get_param_with_override('use_mailer_queue')
         && (EMAIL_LIMIT_PER_MINUTE || EMAIL_LIMIT_PER_HOUR))
     {
         $dbh->do(
@@ -226,7 +226,7 @@ sub MessageToMTA {
     }
 
     # insert into email_rates
-    if (Bugzilla->params->{use_mailer_queue}
+    if (Bugzilla->get_param_with_override('use_mailer_queue')
         && (EMAIL_LIMIT_PER_MINUTE || EMAIL_LIMIT_PER_HOUR))
     {
         $dbh->do(
index 71c1f67cea061c4b4d95f35787984bba42f64435..81c2190e5676507913cd27f942958fc54976b09c 100644 (file)
@@ -37,7 +37,7 @@ sub send {
     unless (close $pipe) {
         return failure "error when closing pipe to $mailer: $!" if $!;
         my ($error_message, $is_transient) = _map_exitcode($? >> 8);
-        if (Bugzilla->params->{'use_mailer_queue'}) {
+        if (Bugzilla->get_param_with_override('use_mailer_queue')) {
             # Return success for errors which are fatal so Bugzilla knows to
             # remove them from the queue
             if ($is_transient) {
index a2b23d069a2b8da5177e11900fa16764a1dc1e48..1576f07b7fceeee59af41479ddf2cab4ee31ff9e 100644 (file)
@@ -297,6 +297,15 @@ BMO_apache_size_limit
   This is the max amount of unshared memory (in kb) that the apache process is
   allowed to use before Apache::SizeLimit kills it.
 
+BMO_mail_delivery_method
+  Usually configured on the MTA section of admin interface, but may be set here for testing purposes.
+  Valid values are None, Test, Sendmail, or SMTP.
+  If set to Test, email will be appended to the /app/data/mailer.test file.
+
+BMO_use_mailer_queue
+  Usually configured on the MTA section of the admin interface, you may change this here for testing purposes.
+  Should be 1 or 0. If 1, the job queue will be used. For testing, only set to 0 if the BMO_mail_delivery_method is None or Test.
+
 HTTPD_StartServers
   Sets the number of child server processes created on startup.
   As the number of processes is dynamically controlled depending on the load,
index 86bd8b9734e1b954965ba8bf9d9962535e7ad39e..62a246ceb59b282af433c4d781eac858eafd9d54 100644 (file)
         and time, and get the result of these queries directly per email. This is a
         good way to create reminders and to keep track of the activity in your installation.</dd>
 
-        [% IF Param('use_mailer_queue') %]
+        [% IF Bugzilla.localconfig.param_override.use_mailer_queue OR Param('use_mailer_queue') %]
           [% class = user.in_group('admin') ? "" : "forbidden" %]
           <dt id="view_job_queue" class="[% class %]"><a href="view_job_queue.cgi">Job Queue</a></dt>
           <dd class="[% class %]">View the queue of undelivered/deferred jobs/emails.</dd>