MantisBT: master ca7d087a

Author Committer Branch Timestamp Parent
dregad dregad master 2015-04-04 06:58 master 9c45e146
Affected Issues  0017460: Email notifications are sent in batches
Changeset

Refactor the email shutdown function

Register email_shutdown_function() from a new generic helper API,
mantis_shutdown_functions_register(); this could be used to add other
shutdown functions or a plugin event in the future.

The shutdown function is now always registered, and the logic to
determine whether to call email_send_all() or not has been moved into
it. This allows removal of the delay implemented in the previous
version to avoid concurrent executions.

The $g_email_stored global variable has been renamed and is now used as
a binary flag which drives the shutdown function's behavior. By setting
this flag, the request can

  • indicate that emails have been generated, allowing the shutdown
    function to trigger email_send_all() only when necessary
  • force sending of emails in the shutdown function, regardless of
    $g_email_send_using_cronjob setting (useful e.g. for signup or
    password reset processes, where we don't want to delay notifications).

To implement that behavior, a new optional parameter ($p_force) was
added to the email_store() function.

These changes are derived from vboctor's comments in PR 589.

Issue 0017460

mod - core.php Diff File
mod - core/constant_inc.php Diff File
mod - core/email_api.php Diff File
mod - core/helper_api.php Diff File
mod - core/logging_api.php Diff File