From cbd1d61e659a0728fb21a3aa47d8fd5fc4ea7571 Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Thu, 19 Jul 2018 17:25:15 +0200
Subject: [PATCH] [TASK] Deprecate TYPO3_OS constant

The TYPO3_OS constant is deprecated with
the introduction of Environment API.

Resolves: #85597
Releases: master
Change-Id: Ie0f844d2d024f2a3f6acdf5af24debead6ba836b
Reviewed-on: https://review.typo3.org/57632
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
---
 typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php | 2 +-
 .../master/Deprecation-85285-DeprecatedSystemConstants.rst  | 5 ++++-
 .../core/Tests/Unit/Resource/ResourceCompressorTest.php     | 2 +-
 .../Configuration/ExtensionScanner/Php/ConstantMatcher.php  | 6 ++++++
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
index e2a5a48f8bce..2ed868d234b5 100644
--- a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
+++ b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
@@ -381,7 +381,7 @@ class SystemEnvironmentBuilder
         }
         // Find out if path is relative or not
         $isRelativePath = false;
-        if (TYPO3_OS === 'WIN') {
+        if (self::getTypo3Os() === 'WIN') {
             if (!preg_match('/^([a-zA-Z]:)?\\\\/', $scriptPath)) {
                 $isRelativePath = true;
             }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85285-DeprecatedSystemConstants.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85285-DeprecatedSystemConstants.rst
index f45734c482d8..969228cfc972 100644
--- a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85285-DeprecatedSystemConstants.rst
+++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85285-DeprecatedSystemConstants.rst
@@ -23,6 +23,9 @@ The following constants have been deprecated and should not be used any longer:
 * :php:`PATH_typo3conf`
   Use :php:`Environment::getPublicPath() . '/typo3conf'` instead
 
+* :php:`TYPO3_OS`
+  Use :php:`Environment::isWindows()` and :php:`Environment::isUnix()` instead
+
 
 Impact
 ======
@@ -48,4 +51,4 @@ Migration
 Usages of the above constants should be switched to the Environment class methods instead.
 
 
-.. index:: PHP-API, FullyScanned
\ No newline at end of file
+.. index:: PHP-API, FullyScanned
diff --git a/typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest.php b/typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest.php
index 1f65b42f6fdb..404fdda093f4 100644
--- a/typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest.php
+++ b/typo3/sysext/core/Tests/Unit/Resource/ResourceCompressorTest.php
@@ -618,7 +618,7 @@ class ResourceCompressorTest extends BaseTestCase
             Environment::getVarPath(),
             Environment::getConfigPath(),
             PATH_site . 'index.php',
-            TYPO3_OS === 'WIN' ? 'WINDOWS' : 'UNIX'
+            Environment::isWindows() ? 'WINDOWS' : 'UNIX'
         );
         $_SERVER['ORIG_SCRIPT_NAME'] = '/index.php';
         $this->subject = $this->getAccessibleMock(ResourceCompressor::class, ['dummy']);
diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php
index c16ac744988a..ec4f4a4b75a7 100644
--- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php
+++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php
@@ -83,4 +83,10 @@ return [
             'Deprecation-85285-DeprecatedSystemConstants.rst',
         ],
     ],
+    'TYPO3_OS' => [
+        'restFiles' => [
+            'Feature-84153-IntroduceAGenericEnvironmentClass.rst',
+            'Deprecation-85285-DeprecatedSystemConstants.rst',
+        ],
+    ],
 ];
-- 
GitLab