Commit f3176918 authored by Nikita Hovratov's avatar Nikita Hovratov
Browse files

[TASK] Deprecate TYPO3\CMS\Core\Utility\ResourceUtility

The core utility class ResourceUtility is a leftover from
an old FAL implementation. In a refactoring in TYPO3 v7 this
class was replaced with a direct implementation and has not
been used in the core ever since.

Resolves: #97576
Related: #56746
Releases: main
Change-Id: I8a7693633573c2e913075754761519cc2330b1f1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74548

Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: Nikita Hovratov's avatarNikita Hovratov <nikita.h@live.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Nikita Hovratov's avatarNikita Hovratov <nikita.h@live.de>
parent 4f223674
...@@ -17,6 +17,8 @@ namespace TYPO3\CMS\Core\Utility; ...@@ -17,6 +17,8 @@ namespace TYPO3\CMS\Core\Utility;
/** /**
* Utility class for the File Abstraction Layer (aka subpackage Resource in EXT:core) * Utility class for the File Abstraction Layer (aka subpackage Resource in EXT:core)
*
* @deprecated This class will be removed in TYPO3 v13.
*/ */
class ResourceUtility class ResourceUtility
{ {
...@@ -33,6 +35,10 @@ class ResourceUtility ...@@ -33,6 +35,10 @@ class ResourceUtility
*/ */
public static function recursiveFileListSortingHelper($elementA, $elementB) public static function recursiveFileListSortingHelper($elementA, $elementB)
{ {
trigger_error(
'Class ' . __CLASS__ . ' has been marked as deprecated in TYPO3 v12 and will be removed in v13. Implement method "recursiveFileListSortingHelper" in your extension if needed.',
E_USER_DEPRECATED,
);
if (!str_contains($elementA, '/')) { if (!str_contains($elementA, '/')) {
// first element is a file // first element is a file
if (!str_contains($elementB, '/')) { if (!str_contains($elementB, '/')) {
...@@ -74,6 +80,13 @@ class ResourceUtility ...@@ -74,6 +80,13 @@ class ResourceUtility
*/ */
public static function nameCompareSortingHelper($elementA, $elementB) public static function nameCompareSortingHelper($elementA, $elementB)
{ {
$backTrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
if (($backTrace[0]['file'] ?? '') !== __FILE__) {
trigger_error(
'Class ' . __CLASS__ . ' has been marked as deprecated in TYPO3 v12 and will be removed in v13. Implement method "nameCompareSortingHelper" in your extension if needed.',
E_USER_DEPRECATED,
);
}
$result = strnatcasecmp($elementA, $elementB); $result = strnatcasecmp($elementA, $elementB);
if ($result === 0) { if ($result === 0) {
// Both are same in case insensitive so it's ok to check then now unnaturally. // Both are same in case insensitive so it's ok to check then now unnaturally.
......
.. include:: /Includes.rst.txt
.. _deprecation-97576-1651949640
============================================================
Deprecation: #97576 - TYPO3\CMS\Core\Utility\ResourceUtility
============================================================
See :issue:`97576`
Description
===========
The class :php:`TYPO3\CMS\Core\Utility\ResourceUtility` has no usage in the core
and is therefore marked as deprecated.
Impact
======
Calling any method of the class :php:`TYPO3\CMS\Core\Utility\ResourceUtility`
will trigger a deprecation level log entry.
Affected installations
======================
All installations using any method of :php:`TYPO3\CMS\Core\Utility\ResourceUtility`
in their own code.
Migration
=========
There is no direct replacement of this class. Extensions that depend on any of the class'
methods should implement them in their codebase.
.. index:: PHP-API, FullyScanned, ext:core
...@@ -15,7 +15,7 @@ declare(strict_types=1); ...@@ -15,7 +15,7 @@ declare(strict_types=1);
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
namespace TYPO3\CMS\Core\Tests\Unit\Utility; namespace TYPO3\CMS\Core\Tests\UnitDeprecated\Utility;
use TYPO3\CMS\Core\Utility\ResourceUtility; use TYPO3\CMS\Core\Utility\ResourceUtility;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase; use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
......
...@@ -1974,4 +1974,9 @@ return [ ...@@ -1974,4 +1974,9 @@ return [
'Deprecation-96641-UnusedHookRelatedUrlProcessorInterface.rst', 'Deprecation-96641-UnusedHookRelatedUrlProcessorInterface.rst',
], ],
], ],
'TYPO3\CMS\Core\Utility\ResourceUtility' => [
'restFiles' => [
'Deprecation-97576-TYPO3CMSCoreUtilityResourceUtility.rst',
],
],
]; ];
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment