You are here

function _mailsystem_get_registry_blacklist_condition in Mail System 7.3

Return a DatabaseCondition representing the registry-blacklist.

By default all files ending with .test are excluded if the simpletest module is disabled. The blacklist pattern can be overridden using the variable mailsystem_get_classes_blacklist.

Return value

DatabaseCondition|null DatabaseCondition representing the blacklist conditions or NULL.

See also

mailsystem_get_classes

1 call to _mailsystem_get_registry_blacklist_condition()
mailsystem_get_classes in ./mailsystem.module
Returns a list of classes which implement MailSystemInterface.

File

./mailsystem.module, line 372
Provide UI for controlling the mail_system variable.

Code

function _mailsystem_get_registry_blacklist_condition() {
  if (!module_exists('simpletest')) {
    $default_blacklist = array(
      array(
        'field' => 'filename',
        'value' => '%.test',
        'operator' => 'NOT LIKE',
      ),
    );
  }
  else {
    $default_blacklist = array();
  }
  $blacklist = variable_get('mailsystem_get_classes_blacklist', $default_blacklist);
  if (!empty($blacklist)) {
    $and = db_and();
    foreach ($blacklist as $entry) {
      if (!empty($entry['field']) && !empty($entry['value']) && !empty($entry['operator'])) {
        $and
          ->condition($entry['field'], $entry['value'], $entry['operator']);
      }
    }
    if ($and
      ->count()) {
      return $and;
    }
  }
}