diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-52286-AddOptionToSystemStatusUpdatesReport-jobToSendAllTests.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-52286-AddOptionToSystemStatusUpdatesReport-jobToSendAllTests.rst new file mode 100644 index 0000000000000000000000000000000000000000..11f76c525c86cafce1e3e2df6b6edb91ecf29243 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-52286-AddOptionToSystemStatusUpdatesReport-jobToSendAllTests.rst @@ -0,0 +1,25 @@ +.. include:: ../../Includes.txt + +==================================================================================== +Feature: #52286 - Add option to "system status updates" report-job to send all tests +==================================================================================== + +See :issue:`52286` + +Description +=========== + +Sometimes it could be useful to get every test in the "System Status Updates (reports)" - also via mail. + +A checkbox was added to the job-configuration for the decision to get a mail if the +system has WARNING or ERROR events, or just get everything. +If the checkbox is not set (default) it works like before, including WARNING and ERROR events only. + + +Impact +====== + +If the checkbox `Notification for all type of status, not only warning and error` is checked, +then the `System Status Update (reports)` contains all type of notifications. + +.. index:: Backend \ No newline at end of file diff --git a/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php b/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php index 12054c0e1260d50fb2a7f576da0c6c102e7b2ef8..8cb9513a50ff6fed8198a4ae5439bf9ddab2dae5 100644 --- a/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php +++ b/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php @@ -35,6 +35,13 @@ class SystemStatusUpdateTask extends AbstractTask */ protected $notificationEmail = null; + /** + * Checkbox for to send all types of notification, not only problems + * + * @var bool + */ + protected $notificationAll = false; + /** * Executes the System Status Update task, determining the highest severity of * status reports and saving that to the registry to be displayed at login @@ -51,7 +58,7 @@ class SystemStatusUpdateTask extends AbstractTask $systemStatus = $statusReport->getDetailedSystemStatus(); $highestSeverity = $statusReport->getHighestSeverity($systemStatus); $registry->set('tx_reports', 'status.highestSeverity', $highestSeverity); - if ($highestSeverity > Status::OK) { + if (($highestSeverity > Status::OK) || $this->getNotificationAll()) { $this->sendNotificationEmail($systemStatus); } return true; @@ -90,7 +97,7 @@ class SystemStatusUpdateTask extends AbstractTask foreach ($systemStatus as $statusProvider) { /** @var Status $status */ foreach ($statusProvider as $status) { - if ($status->getSeverity() > Status::OK) { + if ($this->getNotificationAll() || ($status->getSeverity() > Status::OK)) { $systemIssues[] = (string)$status . CRLF . $status->getMessage() . CRLF . CRLF; } } @@ -101,7 +108,7 @@ class SystemStatusUpdateTask extends AbstractTask $sendEmailsTo[] = $notificationEmail; } $subject = sprintf($this->getLanguageService()->getLL('status_updateTask_email_subject'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']); - $message = sprintf($this->getLanguageService()->getLL('status_problemNotification'), '', ''); + $message = $this->getNotificationAll() ? $this->getLanguageService()->getLL('status_allNotification') : $this->getLanguageService()->getLL('status_problemNotification'); $message .= CRLF . CRLF; $message .= $this->getLanguageService()->getLL('status_updateTask_email_site') . ': ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; $message .= CRLF . CRLF; @@ -118,6 +125,22 @@ class SystemStatusUpdateTask extends AbstractTask $mail->send(); } + /** + * @return bool + */ + public function getNotificationAll(): bool + { + return $this->notificationAll; + } + + /** + * @param bool $notificationAll + */ + public function setNotificationAll(bool $notificationAll) + { + $this->notificationAll = $notificationAll; + } + /** * @return LanguageService */ diff --git a/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTaskNotificationEmailField.php b/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTaskNotificationEmailField.php index 82c1c66f426d91a25b8fa3899dbad7e171a13327..d7aebd639358f59c51b6691cc301da86d4246e9b 100644 --- a/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTaskNotificationEmailField.php +++ b/typo3/sysext/reports/Classes/Task/SystemStatusUpdateTaskNotificationEmailField.php @@ -31,7 +31,7 @@ class SystemStatusUpdateTaskNotificationEmailField implements AdditionalFieldPro * * @var array */ - protected $fields = ['notificationEmail']; + protected $fields = ['notificationEmail', 'notificationAll']; /** * Field prefix. @@ -52,6 +52,7 @@ class SystemStatusUpdateTaskNotificationEmailField implements AdditionalFieldPro { if ($schedulerModule->CMD == 'edit') { $taskInfo[$this->fieldPrefix . 'NotificationEmail'] = $task->getNotificationEmail(); + $taskInfo[$this->fieldPrefix . 'NotificationAll'] = $task->getNotificationAll(); } // build html for additional email field $fieldName = $this->getFullFieldName('notificationEmail'); @@ -66,6 +67,18 @@ class SystemStatusUpdateTaskNotificationEmailField implements AdditionalFieldPro 'cshLabel' => $fieldId ]; + // build html for additional mail all checkbox field + $fieldName = $this->getFullFieldName('notificationAll'); + $fieldId = 'task_' . $fieldName; + $fieldHtml = '<input type="checkbox" name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '" value="1"' . ($taskInfo[$fieldName] ? ' checked="checked"' : '') . '>'; + + $additionalFields[$fieldId] = [ + 'code' => $fieldHtml, + 'label' => 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_updateTaskField_notificationAll', + 'cshKey' => '', + 'cshLabel' => $fieldId + ]; + return $additionalFields; } @@ -106,6 +119,7 @@ class SystemStatusUpdateTaskNotificationEmailField implements AdditionalFieldPro throw new \InvalidArgumentException('Expected a task of type ' . SystemStatusUpdateTask::class . ', but got ' . get_class($task), 1295012802); } $task->setNotificationEmail($submittedData[$this->fieldPrefix . 'NotificationEmail']); + $task->setNotificationAll(!empty($submittedData[$this->fieldPrefix . 'NotificationAll'])); } /** diff --git a/typo3/sysext/reports/Resources/Private/Language/locallang_reports.xlf b/typo3/sysext/reports/Resources/Private/Language/locallang_reports.xlf index a1fc98495a1952b111aa3d3753c84d5d385db2e8..8e677e49928be796e1b267d0adb18cbb086af27c 100644 --- a/typo3/sysext/reports/Resources/Private/Language/locallang_reports.xlf +++ b/typo3/sysext/reports/Resources/Private/Language/locallang_reports.xlf @@ -55,7 +55,10 @@ <source>Update Incomplete</source> </trans-unit> <trans-unit id="status_problemNotification"> - <source>One or more problems were detected with your TYPO3 installation. Please check the %sstatus report%s for more information.</source> + <source>One or more problems were detected with your TYPO3 installation. Please check the status report for more information.</source> + </trans-unit> + <trans-unit id="status_allNotification"> + <source>This report contains all System Status Notifications from your TYPO3 installation. Please check the status report for more information.</source> </trans-unit> <trans-unit id="status_typo3"> <source>TYPO3 System</source> @@ -282,6 +285,9 @@ You can increase the size to 8MB (default on unix) by adding to the httpd.conf: <trans-unit id="status_updateTaskField_notificationEmails_invalid"> <source>Empty or invalid notification email addresses.</source> </trans-unit> + <trans-unit id="status_updateTaskField_notificationAll"> + <source>Always send notification mail (not only on errors or warnings)</source> + </trans-unit> <trans-unit id="status_updateTask_email_subject"> <source>System Status Notification for site %s</source> </trans-unit>