You are here

function mail_logger_enable in Mail Logger 7

Same name and namespace in other branches
  1. 5 mail_logger.install \mail_logger_enable()
  2. 6 mail_logger.install \mail_logger_enable()

Implementation of hook_enable().

File

./mail_logger.install, line 112
Install, update and uninstall functions for the mail_logger module.

Code

function mail_logger_enable() {

  // Because modules can modify the outgoing mail, mail_logger must be executed last in order to capture
  // the final mail parameters by setting the weight of mail_logger to something large.
  $max_weight = db_query("SELECT max(weight) FROM {system} WHERE name <> 'mail_logger'")
    ->fetchField();
  db_query("UPDATE {system} SET weight = :max_weight WHERE name = 'mail_logger'", array(
    ':max_weight' => $max_weight + 100,
  ));
}