Chris@0: get('notification.threshold') == 'all'); Chris@0: foreach (['core', 'contrib'] as $report_type) { Chris@0: $type = 'update_' . $report_type; Chris@0: if (isset($status[$type]['severity']) Chris@0: && ($status[$type]['severity'] == REQUIREMENT_ERROR || ($notify_all && $status[$type]['reason'] == UPDATE_NOT_CURRENT))) { Chris@0: $params[$report_type] = $status[$type]['reason']; Chris@0: } Chris@0: } Chris@0: if (!empty($params)) { Chris@0: $notify_list = $update_config->get('notification.emails'); Chris@0: if (!empty($notify_list)) { Chris@0: $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId(); Chris@0: foreach ($notify_list as $target) { Chris@0: if ($target_user = user_load_by_mail($target)) { Chris@0: $target_langcode = $target_user->getPreferredLangcode(); Chris@0: } Chris@0: else { Chris@0: $target_langcode = $default_langcode; Chris@0: } Chris@0: $message = \Drupal::service('plugin.manager.mail')->mail('update', 'status_notify', $target, $target_langcode, $params); Chris@0: // Track when the last mail was successfully sent to avoid sending Chris@0: // too many emails. Chris@0: if ($message['result']) { Chris@0: \Drupal::state()->set('update.last_email_notification', REQUEST_TIME); Chris@0: } Chris@0: } Chris@0: } Chris@0: } Chris@0: }