From a5d866dbd1556c2968a86555aa90a8c8b585d34c Mon Sep 17 00:00:00 2001 From: Georg Ringer <georg.ringer@gmail.com> Date: Thu, 2 Nov 2017 20:37:19 +0100 Subject: [PATCH] [TASK] Deprecate ClientUtility The class ClientUtility is outdated and not used anymore and can be deprecated. Resolves: #82903 Releases: master Change-Id: I616b4518bfebac8239ecca0b48cad1b037c0ba6d Reviewed-on: https://review.typo3.org/54538 Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org> Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: Benni Mack <benni@typo3.org> --- .../core/Classes/Utility/ClientUtility.php | 4 +++ ...precation-82903-DeprecateClientUtility.rst | 36 +++++++++++++++++++ .../Utility/ClientUtilityTest.php | 0 .../ExtensionScanner/Php/ClassNameMatcher.php | 5 +++ 4 files changed, 45 insertions(+) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-82903-DeprecateClientUtility.rst rename typo3/sysext/core/Tests/{Unit => Unit_Deprecated}/Utility/ClientUtilityTest.php (100%) diff --git a/typo3/sysext/core/Classes/Utility/ClientUtility.php b/typo3/sysext/core/Classes/Utility/ClientUtility.php index 429e65cfbea2..22e2f1d2bcc0 100644 --- a/typo3/sysext/core/Classes/Utility/ClientUtility.php +++ b/typo3/sysext/core/Classes/Utility/ClientUtility.php @@ -24,9 +24,11 @@ class ClientUtility * * @param string $userAgent The useragent string, \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT') * @return array Contains keys "browser", "version", "system + * @deprecated */ public static function getBrowserInfo($userAgent) { + trigger_error('Method getBrowserInfo() is deprecated since v9 and will be removed with v10', E_USER_DEPRECATED); // Hook: $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/div/class.t3lib_utility_client.php']['getBrowserInfo']: $getBrowserInfoHooks = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/div/class.t3lib_utility_client.php']['getBrowserInfo']; if (is_array($getBrowserInfoHooks)) { @@ -174,9 +176,11 @@ class ClientUtility * * @param string $version A string with version number, eg. "/7.32 blablabla * @return float Returns double value, eg. "7.32 + * @deprecated */ public static function getVersion($version) { + trigger_error('Method getVersion() is deprecated since v9 and will be removed with v10', E_USER_DEPRECATED); return (float)preg_replace('/^[^0-9]*/', '', $version); } } diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-82903-DeprecateClientUtility.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-82903-DeprecateClientUtility.rst new file mode 100644 index 000000000000..3d0e33533891 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-82903-DeprecateClientUtility.rst @@ -0,0 +1,36 @@ +.. include:: ../../Includes.txt + +============================================= +Deprecation: #82903 - Deprecate ClientUtility +============================================= + +See :issue:`82903` + +Description +=========== + +Class :php:`\TYPO3\CMS\Core\Utility\ClientUtility` has been marked as deprecated and should not be +used any longer. + + +Impact +====== + +Using this class will throw a deprecation warning. + + +Affected Installations +====================== + +Instances with extensions using the methods of the class: + +- :php:`getBrowserInfo` +- :php:`getVersion` + + +Migration +========= + +Use a 3rd party API like https://github.com/piwik/device-detector + +.. index:: FullyScanned diff --git a/typo3/sysext/core/Tests/Unit/Utility/ClientUtilityTest.php b/typo3/sysext/core/Tests/Unit_Deprecated/Utility/ClientUtilityTest.php similarity index 100% rename from typo3/sysext/core/Tests/Unit/Utility/ClientUtilityTest.php rename to typo3/sysext/core/Tests/Unit_Deprecated/Utility/ClientUtilityTest.php diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php index 5b144b73983a..f29b2401e966 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php @@ -442,6 +442,11 @@ return [ 'Deprecation-82805-RenamedAjaxLoginHandlerPHPClass.rst', ], ], + 'TYPO3\CMS\Core\Utility\ClientUtility' => [ + 'restFiles' => [ + 'Deprecation-82903-DeprecateClientUtility.rst', + ], + ], // Removed interfaces 'TYPO3\CMS\Backend\Form\DatabaseFileIconsHookInterface' => [ -- GitLab