Revert "[TASK] Add verbose output to report mail for failed tests" 50/33750/2
authorHelmut Hummel <helmut.hummel@typo3.org>
Mon, 3 Nov 2014 15:22:32 +0000 (16:22 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Mon, 10 Nov 2014 14:22:47 +0000 (15:22 +0100)
This introduces a new feature, so it cannot go into a released version

This reverts commit 58621d4f2ae14404b242763540214c930fa5977b.

Change-Id: If911d305634f3ac25d4dcc7e86c16c5b96072df1
Reviewed-on: http://review.typo3.org/33750
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Ernesto Baschny <ernst@cron-it.de>
Tested-by: Ernesto Baschny <ernst@cron-it.de>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/install/Classes/Report/EnvironmentStatusReport.php
typo3/sysext/reports/Classes/ExtendedStatusProviderInterface.php [deleted file]
typo3/sysext/reports/Classes/Report/Status/Status.php
typo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php

index 3ea7ffe..f26bf53 100644 (file)
@@ -14,40 +14,20 @@ namespace TYPO3\CMS\Install\Report;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Reports\ExtendedStatusProviderInterface;
-use TYPO3\CMS\Reports\StatusProviderInterface;
-
 /**
  * Provides an environment status report
  *
  * @author Christian Kuhn <lolli@schwarzbu.ch>
  */
-class EnvironmentStatusReport implements StatusProviderInterface, ExtendedStatusProviderInterface {
+class EnvironmentStatusReport implements \TYPO3\CMS\Reports\StatusProviderInterface {
 
        /**
         * Compile environment status report
         *
-        * @return \TYPO3\CMS\Reports\Status[]
-        */
-       public function getStatus() {
-               return $this->getStatusInternal(FALSE);
-       }
-
-       /**
-        * Returns the detailed status of an extension or (sub)system
-        *
-        * @return \TYPO3\CMS\Reports\Status[]
-        */
-       public function getDetailedStatus() {
-               return $this->getStatusInternal(TRUE);
-       }
-
-       /**
-        * @param $verbose
-        * @return \TYPO3\CMS\Reports\Status[]
         * @throws \TYPO3\CMS\Install\Exception
+        * @return array<\TYPO3\CMS\Reports\Status>
         */
-       protected function getStatusInternal($verbose) {
+       public function getStatus() {
                /** @var $statusCheck \TYPO3\CMS\Install\SystemEnvironment\Check */
                $statusCheck = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\SystemEnvironment\\Check');
                $statusObjects = $statusCheck->getStatus();
@@ -72,22 +52,13 @@ class EnvironmentStatusReport implements StatusProviderInterface, ExtendedStatus
                $statusArray = array();
                foreach ($reportStatusTypes as $type => $statusObjects) {
                        $value = count($statusObjects);
-                       $message = '';
-                       if ($verbose) {
-                               foreach ($statusObjects as $statusObject) {
-                                       $message .= '### ' . $statusObject->getTitle() . ': ' . $statusObject->getSeverity() . CRLF;
-                               }
-                       }
-
                        if ($value > 0) {
                                $pathToXliff = 'LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf';
                                // Map information type to abbreviation which is used in \TYPO3\CMS\Reports\Status class
                                if ($type === 'information') {
                                        $type = 'info';
                                }
-                               if (!$verbose) {
-                                       $message = $GLOBALS['LANG']->sL($pathToXliff . ':environment.status.message.' . $type);
-                               }
+                               $message = $GLOBALS['LANG']->sL($pathToXliff . ':environment.status.message.' . $type);
                                $severity = constant('\TYPO3\CMS\Reports\Status::' . strtoupper($type));
                                $statusArray[] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
                                        'TYPO3\\CMS\\Reports\\Status',
@@ -101,5 +72,4 @@ class EnvironmentStatusReport implements StatusProviderInterface, ExtendedStatus
 
                return $statusArray;
        }
-
 }
diff --git a/typo3/sysext/reports/Classes/ExtendedStatusProviderInterface.php b/typo3/sysext/reports/Classes/ExtendedStatusProviderInterface.php
deleted file mode 100644 (file)
index bcf592a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-namespace TYPO3\CMS\Reports;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Interface for classes which provide a status report entry.
- *
- * @author Markus Klein <klein.t3@reelworx.at>
- */
-interface ExtendedStatusProviderInterface {
-
-       /**
-        * Returns the detailed status of an extension or (sub)system
-        *
-        * @return \TYPO3\CMS\Reports\Status[]
-        */
-       public function getDetailedStatus();
-
-}
index 765a40d..60813dc 100644 (file)
@@ -13,20 +13,15 @@ namespace TYPO3\CMS\Reports\Report\Status;
  *
  * The TYPO3 project - inspiring people to share!
  */
-
-use TYPO3\CMS\Reports\ExtendedStatusProviderInterface;
-use TYPO3\CMS\Reports\ReportInterface;
-use TYPO3\CMS\Reports\StatusProviderInterface;
-
 /**
  * The status report
  *
  * @author Ingo Renner <ingo@typo3.org>
  */
-class Status implements ReportInterface {
+class Status implements \TYPO3\CMS\Reports\ReportInterface {
 
        /**
-        * @var StatusProviderInterface[][]
+        * @var array
         */
        protected $statusProviders = array();
 
@@ -64,7 +59,7 @@ class Status implements ReportInterface {
                        $this->statusProviders[$key] = array();
                        foreach ($statusProvidersList as $statusProvider) {
                                $statusProviderInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($statusProvider);
-                               if ($statusProviderInstance instanceof StatusProviderInterface) {
+                               if ($statusProviderInstance instanceof \TYPO3\CMS\Reports\StatusProviderInterface) {
                                        $this->statusProviders[$key][] = $statusProviderInstance;
                                }
                        }
@@ -74,7 +69,7 @@ class Status implements ReportInterface {
        /**
         * Runs through all status providers and returns all statuses collected.
         *
-        * @return \TYPO3\CMS\Reports\Status[]
+        * @return array An array of \TYPO3\CMS\Reports\Status objects
         */
        public function getSystemStatus() {
                $status = array();
@@ -89,25 +84,6 @@ class Status implements ReportInterface {
        }
 
        /**
-        * Runs through all status providers and returns all statuses collected, which are detailed.
-        *
-        * @return \TYPO3\CMS\Reports\Status[]
-        */
-       public function getDetailedSystemStatus() {
-               $status = array();
-               foreach ($this->statusProviders as $statusProviderId => $statusProviderList) {
-                       $status[$statusProviderId] = array();
-                       foreach ($statusProviderList as $statusProvider) {
-                               if ($statusProvider instanceof ExtendedStatusProviderInterface) {
-                                       $statuses = $statusProvider->getDetailedStatus();
-                                       $status[$statusProviderId] = array_merge($status[$statusProviderId], $statuses);
-                               }
-                       }
-               }
-               return $status;
-       }
-
-       /**
         * Determines the highest severity from the given statuses.
         *
         * @param array $statusCollection An array of \TYPO3\CMS\Reports\Status objects.
@@ -230,7 +206,6 @@ class Status implements ReportInterface {
        protected function sortStatuses(array $statusCollection) {
                $statuses = array();
                $sortTitle = array();
-               $header = NULL;
                /** @var $status \TYPO3\CMS\Reports\Status */
                foreach ($statusCollection as $status) {
                        if ($status->getTitle() === 'TYPO3') {
index c15c0f8..aa10b40 100644 (file)
@@ -13,18 +13,12 @@ namespace TYPO3\CMS\Reports\Task;
  *
  * The TYPO3 project - inspiring people to share!
  */
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Core\Utility\MailUtility;
-use TYPO3\CMS\Reports\Status;
-use TYPO3\CMS\Scheduler\Task\AbstractTask;
-
 /**
  * A task that should be run regularly to determine the system's status.
  *
  * @author Ingo Renner <ingo@typo3.org>
  */
-class SystemStatusUpdateTask extends AbstractTask {
+class SystemStatusUpdateTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
 
        /**
         * Email addresses to send email notification to in case we find problems with
@@ -43,13 +37,13 @@ class SystemStatusUpdateTask extends AbstractTask {
         */
        public function execute() {
                /** @var $registry \TYPO3\CMS\Core\Registry */
-               $registry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
+               $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
                /** @var $statusReport \TYPO3\CMS\Reports\Report\Status\Status */
-               $statusReport = GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Report\\Status\\Status');
-               $systemStatus = $statusReport->getDetailedSystemStatus();
+               $statusReport = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Report\\Status\\Status');
+               $systemStatus = $statusReport->getSystemStatus();
                $highestSeverity = $statusReport->getHighestSeverity($systemStatus);
                $registry->set('tx_reports', 'status.highestSeverity', $highestSeverity);
-               if ($highestSeverity > Status::OK) {
+               if ($highestSeverity > \TYPO3\CMS\Reports\Status::OK) {
                        $this->sendNotificationEmail($systemStatus);
                }
                return TRUE;
@@ -77,20 +71,19 @@ class SystemStatusUpdateTask extends AbstractTask {
        /**
         * Sends a notification email, reporting system issues.
         *
-        * @param Status[] $systemStatus Array of statuses
+        * @param array $systemStatus Array of statuses
         * @return void
         */
        protected function sendNotificationEmail(array $systemStatus) {
                $systemIssues = array();
                foreach ($systemStatus as $statusProvider) {
-                       /** @var Status $status */
                        foreach ($statusProvider as $status) {
-                               if ($status->getSeverity() > Status::OK) {
-                                       $systemIssues[] = (string)$status . CRLF . $status->getMessage() . CRLF . CRLF;
+                               if ($status->getSeverity() > \TYPO3\CMS\Reports\Status::OK) {
+                                       $systemIssues[] = (string) $status;
                                }
                        }
                }
-               $notificationEmails = GeneralUtility::trimExplode(LF, $this->notificationEmail, TRUE);
+               $notificationEmails = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $this->notificationEmail, TRUE);
                $sendEmailsTo = array();
                foreach ($notificationEmails as $notificationEmail) {
                        $sendEmailsTo[] = $notificationEmail;
@@ -103,9 +96,9 @@ class SystemStatusUpdateTask extends AbstractTask {
                $message .= $GLOBALS['LANG']->getLL('status_updateTask_email_issues') . ': ' . CRLF;
                $message .= implode(CRLF, $systemIssues);
                $message .= CRLF . CRLF;
-               $from = MailUtility::getSystemFrom();
+               $from = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFrom();
                /** @var $mail \TYPO3\CMS\Core\Mail\MailMessage */
-               $mail = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
+               $mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
                $mail->setFrom($from);
                $mail->setTo($sendEmailsTo);
                $mail->setSubject($subject);