[FOLLOWUP][CLEANUP] Code cleanup in ext:reports 35/45735/3
authorDaniel Goerz <ervaude@gmail.com>
Fri, 8 Jan 2016 19:43:09 +0000 (20:43 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Fri, 8 Jan 2016 20:43:52 +0000 (21:43 +0100)
Fixes a falsely use statement.

Change-Id: I1b793865a334f15142869f1c72909c4ec25d4c9d
Resolves: #72513
Releases: master
Reviewed-on: https://review.typo3.org/45735
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/reports/Classes/Report/Status/ConfigurationStatus.php
typo3/sysext/reports/Classes/Report/Status/FalStatus.php
typo3/sysext/reports/Classes/Report/Status/SecurityStatus.php
typo3/sysext/reports/Classes/Report/Status/SystemStatus.php
typo3/sysext/reports/Classes/Report/Status/WarningMessagePostProcessor.php

index d9dce77..bb39753 100644 (file)
@@ -22,7 +22,7 @@ use TYPO3\CMS\Core\Registry;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Lang\LanguageService;
-use TYPO3\CMS\Reports\Status;
+use TYPO3\CMS\Reports\Status as ReportStatus;
 use TYPO3\CMS\Reports\StatusProviderInterface;
 
 /**
@@ -82,17 +82,17 @@ class ConfigurationStatus implements StatusProviderInterface
     {
         $value = $this->getLanguageService()->getLL('status_ok');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         $count = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'sys_refindex');
         $registry = GeneralUtility::makeInstance(Registry::class);
         $lastRefIndexUpdate = $registry->get('core', 'sys_refindex_lastUpdate');
         if (!$count && $lastRefIndexUpdate) {
             $value = $this->getLanguageService()->getLL('status_empty');
-            $severity = Status::WARNING;
+            $severity = ReportStatus::WARNING;
             $url =  BackendUtility::getModuleUrl('system_dbint') . '&id=0&SET[function]=refindex';
             $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.backend_reference_index'), '<a href="' . htmlspecialchars($url) . '">', '</a>', BackendUtility::dateTime($lastRefIndexUpdate));
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_referenceIndex'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_referenceIndex'), $value, $message, $severity);
     }
 
     /**
@@ -142,7 +142,7 @@ class ConfigurationStatus implements StatusProviderInterface
     {
         $value = $this->getLanguageService()->getLL('status_ok');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         $failedConnections = array();
         $defaultMemcachedPort = ini_get('memcache.default_port');
         $memcachedServers = $this->getConfiguredMemcachedServers();
@@ -173,10 +173,10 @@ class ConfigurationStatus implements StatusProviderInterface
         }
         if (!empty($failedConnections)) {
             $value = $this->getLanguageService()->getLL('status_connectionFailed');
-            $severity = Status::WARNING;
+            $severity = ReportStatus::WARNING;
             $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.memcache_not_usable') . '<br /><br />' . '<ul><li>' . implode('</li><li>', $failedConnections) . '</li></ul>';
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_memcachedConfiguration'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_memcachedConfiguration'), $value, $message, $severity);
     }
 
     /**
@@ -190,11 +190,11 @@ class ConfigurationStatus implements StatusProviderInterface
         $title = $this->getLanguageService()->getLL('status_configuration_DeprecationLog');
         $value = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:disabled');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog']) {
             $value = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:enabled');
             $message = '<p>' . $this->getLanguageService()->getLL('status_configuration_DeprecationLogEnabled') . '</p>';
-            $severity = Status::NOTICE;
+            $severity = ReportStatus::NOTICE;
             $logFile = GeneralUtility::getDeprecationLogFileName();
             $logFileSize = 0;
             if (@file_exists($logFile)) {
@@ -204,13 +204,13 @@ class ConfigurationStatus implements StatusProviderInterface
                 $message .= '<p>' . sprintf($this->getLanguageService()->getLL('status_configuration_DeprecationLogSize'), GeneralUtility::formatSize($logFileSize)) . ' <a href="' . $removeDeprecationLogFileUrl . '">' . $this->getLanguageService()->getLL('status_configuration_DeprecationLogDeleteLink') . '</a></p>';
             }
             if ($logFileSize > $this->deprecationLogFileSizeWarningThreshold) {
-                $severity = Status::WARNING;
+                $severity = ReportStatus::WARNING;
             }
             if ($logFileSize > $this->deprecationLogFileSizeErrorThreshold) {
-                $severity = Status::ERROR;
+                $severity = ReportStatus::ERROR;
             }
         }
-        return GeneralUtility::makeInstance(Status::class, $title, $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $title, $value, $message, $severity);
     }
 
     /**
@@ -222,13 +222,13 @@ class ConfigurationStatus implements StatusProviderInterface
     {
         $value = $this->getLanguageService()->getLL('status_ok');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         if ((int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] % 10 & 2) {
             $value = $GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'];
-            $severity = Status::WARNING;
+            $severity = ReportStatus::WARNING;
             $message = $this->getLanguageService()->getLL('status_CreatedFilePermissions.writable');
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_CreatedFilePermissions'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_CreatedFilePermissions'), $value, $message, $severity);
     }
 
     /**
@@ -240,13 +240,13 @@ class ConfigurationStatus implements StatusProviderInterface
     {
         $value = $this->getLanguageService()->getLL('status_ok');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         if ((int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] % 10 & 2) {
             $value = $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'];
-            $severity = Status::WARNING;
+            $severity = ReportStatus::WARNING;
             $message = $this->getLanguageService()->getLL('status_CreatedDirectoryPermissions.writable');
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_CreatedDirectoryPermissions'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_CreatedDirectoryPermissions'), $value, $message, $severity);
     }
 
     /**
index 6d6344d..4a78086 100644 (file)
@@ -18,7 +18,7 @@ use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Resource\StorageRepository;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
-use TYPO3\CMS\Reports\Status;
+use TYPO3\CMS\Reports\Status as ReportStatus;
 use TYPO3\CMS\Reports\StatusProviderInterface;
 
 /**
@@ -50,7 +50,7 @@ class FalStatus implements StatusProviderInterface
         $count = 0;
         $maxFilesToShow = 100;
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
 
         /** @var StorageRepository $storageRepository */
         $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
@@ -76,7 +76,7 @@ class FalStatus implements StatusProviderInterface
 
         if ($count) {
             $value = sprintf($this->getLanguageService()->getLL('status_missingFilesCount'), $count);
-            $severity = Status::WARNING;
+            $severity = ReportStatus::WARNING;
 
             $files = $this->getDatabaseConnection()->exec_SELECTgetRows(
                 'identifier,storage',
@@ -97,7 +97,7 @@ class FalStatus implements StatusProviderInterface
             }
         }
 
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_missingFiles'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_missingFiles'), $value, $message, $severity);
     }
 
     /**
index 50da32e..cf6fd96 100644 (file)
@@ -20,7 +20,8 @@ use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\TypoScript\ConfigurationForm;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
-use TYPO3\CMS\Reports\Status;
+use TYPO3\CMS\Reports\Status as ReportStatus;
+use TYPO3\CMS\Reports\StatusProviderInterface;
 use TYPO3\CMS\Saltedpasswords\Salt\SaltFactory;
 use TYPO3\CMS\Saltedpasswords\Utility\ExtensionManagerConfigurationUtility;
 use TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility;
@@ -28,7 +29,7 @@ use TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility;
 /**
  * Performs several checks about the system's health
  */
-class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
+class SecurityStatus implements StatusProviderInterface
 {
     /**
      * Determines the security of this TYPO3 installation
@@ -57,13 +58,13 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
     {
         $value = $this->getLanguageService()->getLL('status_ok');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] === GeneralUtility::ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL) {
             $value = $this->getLanguageService()->getLL('status_insecure');
-            $severity = Status::ERROR;
+            $severity = ReportStatus::ERROR;
             $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_trustedhosts');
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_trustedHostsPattern'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_trustedHostsPattern'), $value, $message, $severity);
     }
 
     /**
@@ -75,7 +76,7 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
     {
         $value = $this->getLanguageService()->getLL('status_ok');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         $whereClause = 'username = ' . $this->getDatabaseConnection()->fullQuoteStr('admin', 'be_users') .
             BackendUtility::deleteClause('be_users');
         $res = $this->getDatabaseConnection()->exec_SELECTquery('uid, username, password', 'be_users', $whereClause);
@@ -95,7 +96,7 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
             }
             if (!$secure) {
                 $value = $this->getLanguageService()->getLL('status_insecure');
-                $severity = Status::ERROR;
+                $severity = ReportStatus::ERROR;
                 $editUserAccountUrl = BackendUtility::getModuleUrl(
                     'record_edit',
                     array(
@@ -111,7 +112,7 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
             }
         }
         $this->getDatabaseConnection()->sql_free_result($res);
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_adminUserAccount'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_adminUserAccount'), $value, $message, $severity);
     }
 
     /**
@@ -123,10 +124,10 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
     {
         $value = $this->getLanguageService()->getLL('status_ok');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
             $value = $this->getLanguageService()->getLL('status_insecure');
-            $severity = Status::ERROR;
+            $severity = ReportStatus::ERROR;
             $url = 'install/index.php?redirect_url=index.php' . urlencode('?TYPO3_INSTALL[type]=config#set_encryptionKey');
             $message = sprintf(
                 $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_encryption'),
@@ -134,7 +135,7 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
                 '</a>'
             );
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_encryptionKey'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_encryptionKey'), $value, $message, $severity);
     }
 
     /**
@@ -146,19 +147,19 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
     {
         $value = $this->getLanguageService()->getLL('status_ok');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         $defaultParts = GeneralUtility::trimExplode('|', FILE_DENY_PATTERN_DEFAULT, true);
         $givenParts = GeneralUtility::trimExplode('|', $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'], true);
         $result = array_intersect($defaultParts, $givenParts);
         if ($defaultParts !== $result) {
             $value = $this->getLanguageService()->getLL('status_insecure');
-            $severity = Status::ERROR;
+            $severity = ReportStatus::ERROR;
             $message = sprintf(
                 $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_deny_pattern_partsNotPresent'),
                 '<br /><pre>' . htmlspecialchars(FILE_DENY_PATTERN_DEFAULT) . '</pre><br />'
             );
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_fileDenyPattern'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_fileDenyPattern'), $value, $message, $severity);
     }
 
     /**
@@ -171,14 +172,14 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
     {
         $value = $this->getLanguageService()->getLL('status_ok');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         if ($GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] != FILE_DENY_PATTERN_DEFAULT
             && GeneralUtility::verifyFilenameAgainstDenyPattern('.htaccess')) {
             $value = $this->getLanguageService()->getLL('status_insecure');
-            $severity = Status::ERROR;
+            $severity = ReportStatus::ERROR;
             $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_deny_htaccess');
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_htaccessUploadProtection'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_htaccessUploadProtection'), $value, $message, $severity);
     }
 
     /**
@@ -189,7 +190,7 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
     protected function getSaltedPasswordsStatus()
     {
         $value = $this->getLanguageService()->getLL('status_ok');
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         /** @var ExtensionManagerConfigurationUtility $configCheck */
         $configCheck = GeneralUtility::makeInstance(ExtensionManagerConfigurationUtility::class);
         $message = '<p>' . $this->getLanguageService()->getLL('status_saltedPasswords_infoText') . '</p>';
@@ -200,12 +201,12 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
                 $messageDetail .= $resultCheck['html'];
                 break;
             case FlashMessage::WARNING:
-                $severity = Status::WARNING;
+                $severity = ReportStatus::WARNING;
                 $messageDetail .= $resultCheck['html'];
                 break;
             case FlashMessage::ERROR:
                 $value = $this->getLanguageService()->getLL('status_insecure');
-                $severity = Status::ERROR;
+                $severity = ReportStatus::ERROR;
                 $messageDetail .= $resultCheck['html'];
                 break;
             default:
@@ -213,7 +214,7 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
         $unsecureUserCount = SaltedPasswordsUtility::getNumberOfBackendUsersWithInsecurePassword();
         if ($unsecureUserCount > 0) {
             $value = $this->getLanguageService()->getLL('status_insecure');
-            $severity = Status::ERROR;
+            $severity = ReportStatus::ERROR;
             $messageDetail .= '<div class="panel panel-warning">' .
                 '<div class="panel-body">' .
                     $this->getLanguageService()->getLL('status_saltedPasswords_notAllPasswordsHashed') .
@@ -224,7 +225,7 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface
         if (empty($messageDetail)) {
             $message = '';
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_saltedPasswords'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_saltedPasswords'), $value, $message, $severity);
     }
 
     /**
index 12c53f2..8b953ed 100644 (file)
@@ -16,7 +16,7 @@ namespace TYPO3\CMS\Reports\Report\Status;
 use TYPO3\CMS\Core\Registry;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
-use TYPO3\CMS\Reports\Status;
+use TYPO3\CMS\Reports\Status as ReportStatus;
 use TYPO3\CMS\Reports\StatusProviderInterface;
 
 /**
@@ -71,7 +71,7 @@ class SystemStatus implements StatusProviderInterface
         $memoryLimit = GeneralUtility::getBytesFromSizeMeasurement(ini_get('memory_limit'));
         $value = $this->getLanguageService()->getLL('status_ok');
         $message = '';
-        $severity = Status::OK;
+        $severity = ReportStatus::OK;
         $bytesUsed = $peakMemoryUsage['used'];
         $percentageUsed = $memoryLimit ? number_format($bytesUsed / $memoryLimit * 100, 1) . '%' : '?';
         $dateOfPeak = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $peakMemoryUsage['tstamp']);
@@ -80,10 +80,10 @@ class SystemStatus implements StatusProviderInterface
         if ($peakMemoryUsage['used']) {
             $message = sprintf($this->getLanguageService()->getLL('status_phpPeakMemoryTooHigh'), GeneralUtility::formatSize($peakMemoryUsage['used']), $percentageUsed, GeneralUtility::formatSize($memoryLimit), $dateOfPeak, $urlOfPeak);
             $message .= ' <a href="' . $clearFlagUrl . '">' . $this->getLanguageService()->getLL('status_phpPeakMemoryClearFlag') . '</a>.';
-            $severity = Status::WARNING;
+            $severity = ReportStatus::WARNING;
             $value = $percentageUsed;
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_phpPeakMemory'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_phpPeakMemory'), $value, $message, $severity);
     }
 
     /**
@@ -120,13 +120,13 @@ class SystemStatus implements StatusProviderInterface
             $value = $this->getLanguageService()->getLL('status_phpModulesMissing');
             $message = sprintf($this->getLanguageService()->getLL('status_phpModulesList'), implode(', ', $missingPhpModules));
             $message .= ' ' . $this->getLanguageService()->getLL('status_phpModulesInfo');
-            $severity = Status::ERROR;
+            $severity = ReportStatus::ERROR;
         } else {
             $value = $this->getLanguageService()->getLL('status_phpModulesPresent');
             $message = '';
-            $severity = Status::OK;
+            $severity = ReportStatus::OK;
         }
-        return GeneralUtility::makeInstance(Status::class, $this->getLanguageService()->getLL('status_phpModules'), $value, $message, $severity);
+        return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_phpModules'), $value, $message, $severity);
     }
 
     /**
index 61354af..6e5421b 100644 (file)
@@ -17,7 +17,7 @@ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Registry;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
-use TYPO3\CMS\Reports\Status;
+use TYPO3\CMS\Reports\Status as ReportStatus;
 
 /**
  * Post processes the warning messages found in about modules.
@@ -43,7 +43,7 @@ class WarningMessagePostProcessor
         $registry = GeneralUtility::makeInstance(Registry::class);
         $highestSeverity = $registry->get('tx_reports', 'status.highestSeverity', null);
         if (!is_null($highestSeverity)) {
-            if ($highestSeverity > Status::OK) {
+            if ($highestSeverity > ReportStatus::OK) {
                 // Display a message that there's something wrong and that
                 // the admin should take a look at the detailed status report
                 $this->getLanguageService()->includeLLFile('EXT:reports/Resources/Private/Language/locallang_reports.xlf');