[!!!][TASK] Remove deprecated $GLOBALS['TYPO3_GLOBALS_EXT'] 07/59207/2
authorBenjamin Franzke <bfr@qbus.de>
Wed, 19 Dec 2018 09:48:48 +0000 (10:48 +0100)
committerBenni Mack <benni@typo3.org>
Wed, 19 Dec 2018 10:38:17 +0000 (11:38 +0100)
$GLOBALS['TYPO3_GLOBALS_EXT'] was deprecated in
https://review.typo3.org/58408 and is now removed together
with the internal helper classes LoadedExtensionsArray
and LoadedExtensionArrayElement which powered this array.

Releases: master
Resolves: #87209
Change-Id: Ic323f881b5d07aa70046becf837a2d1dda0d9400
Reviewed-on: https://review.typo3.org/59207
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Classes/Compatibility/LoadedExtensionArrayElement.php [deleted file]
typo3/sysext/core/Classes/Compatibility/LoadedExtensionsArray.php [deleted file]
typo3/sysext/core/Classes/Package/PackageManager.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayGlobalMatcher.php
typo3/sysext/lowlevel/Classes/Controller/ConfigurationController.php
typo3/sysext/lowlevel/Resources/Private/Language/locallang.xlf

diff --git a/typo3/sysext/core/Classes/Compatibility/LoadedExtensionArrayElement.php b/typo3/sysext/core/Classes/Compatibility/LoadedExtensionArrayElement.php
deleted file mode 100644 (file)
index 177b340..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Compatibility;
-
-/*
- * 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!
- */
-
-use TYPO3\CMS\Core\Core\Environment;
-use TYPO3\CMS\Core\Package\PackageInterface;
-
-/**
- * Class to simulate the "old" extension information array element
- *
- * @internal
- */
-class LoadedExtensionArrayElement implements \IteratorAggregate, \ArrayAccess, \Serializable, \Countable
-{
-    /**
-     * @var PackageInterface Instance of package manager
-     */
-    protected $package;
-
-    /**
-     * @var array List of relevant extension files
-     */
-    protected $extensionFilesToCheckFor = [
-        'ext_localconf.php',
-        'ext_tables.php',
-        'ext_tables.sql',
-        'ext_tables_static+adt.sql',
-        'ext_typoscript_constants.typoscript',
-        'ext_typoscript_setup.typoscript',
-        'ext_typoscript_constants.txt',
-        'ext_typoscript_setup.txt'
-    ];
-
-    /**
-     * @var array Final extension information
-     */
-    protected $extensionInformation = [];
-
-    /**
-     * Constructor builds compatibility API
-     *
-     * @param PackageInterface $package
-     */
-    public function __construct(PackageInterface $package)
-    {
-        $this->package = $package;
-        $this->initializeBasicExtensionInformation();
-        $this->initializeExtensionFiles();
-        $this->initializeExtensionIcon();
-    }
-
-    /**
-     * Create main information
-     */
-    protected function initializeBasicExtensionInformation()
-    {
-        $pathSite = Environment::getPublicPath() . '/';
-        $pathSiteLength = strlen($pathSite);
-        $absolutePackagePath = $this->package->getPackagePath();
-        if (strpos($absolutePackagePath, $pathSite) === 0) {
-            $relativePackagePathToPathSite = substr($absolutePackagePath, $pathSiteLength);
-            $relativePackagePathToPathSiteSegments = explode('/', $relativePackagePathToPathSite);
-            $packageType = null;
-            // Determine if extension is installed locally, globally or system (in this order)
-            switch (implode('/', array_slice($relativePackagePathToPathSiteSegments, 0, 2))) {
-                case 'typo3conf/ext':
-                    $packageType = 'L';
-                    break;
-                case TYPO3_mainDir . 'ext':
-                    $packageType = 'G';
-                    break;
-                case TYPO3_mainDir . 'sysext':
-                    $packageType = 'S';
-                    break;
-                case 'typo3temp/var/tests/test_ext':
-                    $packageType = 'T';
-                    break;
-            }
-            if ($packageType !== null) {
-                $this->extensionInformation['type'] = $packageType;
-            }
-        }
-    }
-
-    /**
-     * Initialize extension icon
-     */
-    protected function initializeExtensionIcon()
-    {
-        $this->extensionInformation['ext_icon'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionIcon($this->package->getPackagePath());
-    }
-
-    /**
-     * Register found files in extension array if extension was found
-     */
-    protected function initializeExtensionFiles()
-    {
-        foreach ($this->extensionFilesToCheckFor as $fileName) {
-            $absolutePathToFile = $this->package->getPackagePath() . $fileName;
-            if (@file_exists($absolutePathToFile)) {
-                $this->extensionInformation[$fileName] = $absolutePathToFile;
-            }
-        }
-    }
-
-    /**
-     * Retrieve an external iterator
-     *
-     * @link http://php.net/manual/en/iteratoraggregate.getiterator.php
-     * @return \Traversable An instance of an object implementing Iterator or Traversable
-     */
-    public function getIterator()
-    {
-        return new \ArrayIterator($this->extensionInformation);
-    }
-
-    /**
-     * Whether an offset exists
-     *
-     * @link http://php.net/manual/en/arrayaccess.offsetexists.php
-     * @param mixed $offset An offset to check for.
-     * @return bool TRUE on success or FALSE on failure.
-     */
-    public function offsetExists($offset)
-    {
-        return isset($this->extensionInformation[$offset]);
-    }
-
-    /**
-     * Offset to retrieve
-     *
-     * @link http://php.net/manual/en/arrayaccess.offsetget.php
-     * @param mixed $offset The offset to retrieve.
-     * @return mixed Can return all value types.
-     */
-    public function offsetGet($offset)
-    {
-        return $this->extensionInformation[$offset];
-    }
-
-    /**
-     * Offset to set
-     *
-     * @link http://php.net/manual/en/arrayaccess.offsetset.php
-     * @param mixed $offset The offset to assign the value to.
-     * @param mixed $value The value to set.
-     * @throws \InvalidArgumentException
-     */
-    public function offsetSet($offset, $value)
-    {
-        throw new \InvalidArgumentException('The array $GLOBALS[\'TYPO3_LOADED_EXT\'] may not be modified.', 1361915115);
-    }
-
-    /**
-     * Offset to unset
-     *
-     * @link http://php.net/manual/en/arrayaccess.offsetunset.php
-     * @param mixed $offset The offset to unset.
-     * @throws \InvalidArgumentException
-     */
-    public function offsetUnset($offset)
-    {
-        throw new \InvalidArgumentException('The array $GLOBALS[\'TYPO3_LOADED_EXT\'] may not be modified.', 1361915206);
-    }
-
-    /**
-     * String representation of object
-     *
-     * @link http://php.net/manual/en/serializable.serialize.php
-     * @return string the string representation of the object or null
-     */
-    public function serialize()
-    {
-        return serialize($this->extensionInformation);
-    }
-
-    /**
-     * Constructs the object
-     *
-     * @link http://php.net/manual/en/serializable.unserialize.php
-     * @param string $serialized The string representation of the object.
-     * @return mixed the original value unserialized.
-     */
-    public function unserialize($serialized)
-    {
-        $this->extensionInformation = unserialize($serialized);
-    }
-
-    /**
-     * Count elements of an object
-     *
-     * @link http://php.net/manual/en/countable.count.php
-     * @return int The custom count as an integer. The return value is cast to an integer.
-     */
-    public function count()
-    {
-        return count($this->extensionInformation);
-    }
-
-    /**
-     * @return array
-     */
-    public function toArray()
-    {
-        return iterator_to_array($this);
-    }
-}
diff --git a/typo3/sysext/core/Classes/Compatibility/LoadedExtensionsArray.php b/typo3/sysext/core/Classes/Compatibility/LoadedExtensionsArray.php
deleted file mode 100644 (file)
index 5f49675..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Compatibility;
-
-/*
- * 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!
- */
-
-/**
- * Class to simulate the "old" extension information array
- *
- * @internal
- */
-class LoadedExtensionsArray implements \Iterator, \ArrayAccess, \Serializable, \Countable
-{
-    /**
-     * @var \TYPO3\CMS\Core\Package\PackageManager Instance of package manager
-     */
-    protected $packageManager;
-
-    /**
-     * @var array Loaded element cache
-     */
-    protected $loadedExtensionArrayElementCache = [];
-
-    /**
-     * @var string Pointer to current position
-     */
-    protected $iteratorPosition;
-
-    /**
-     * @param \TYPO3\CMS\Core\Package\PackageManager $packageManager
-     */
-    public function __construct(\TYPO3\CMS\Core\Package\PackageManager $packageManager)
-    {
-        $this->packageManager = $packageManager;
-    }
-
-    /**
-     * Whether an offset exists
-     *
-     * @link http://php.net/manual/en/arrayaccess.offsetexists.php
-     * @param mixed $offset An offset to check for.
-     * @return bool TRUE on success or FALSE on failure.
-     */
-    public function offsetExists($offset)
-    {
-        return $this->packageManager->isPackageActive($offset);
-    }
-
-    /**
-     * Offset to retrieve
-     *
-     * @link http://php.net/manual/en/arrayaccess.offsetget.php
-     * @param mixed $offset The offset to retrieve.
-     * @return mixed Can return all value types.
-     */
-    public function offsetGet($offset)
-    {
-        // Pass it through the package manager, as it resolves package aliases
-        $package = $this->packageManager->getPackage($offset);
-        $packageKey = $package->getPackageKey();
-        if (!isset($this->loadedExtensionArrayElementCache[$packageKey])) {
-            $this->loadedExtensionArrayElementCache[$packageKey] = new LoadedExtensionArrayElement($package);
-        }
-        return $this->loadedExtensionArrayElementCache[$packageKey];
-    }
-
-    /**
-     * Offset to set
-     *
-     * @link http://php.net/manual/en/arrayaccess.offsetset.php
-     * @param mixed $offset The offset to assign the value to.
-     * @param mixed $value The value to set.
-     * @throws \InvalidArgumentException
-     */
-    public function offsetSet($offset, $value)
-    {
-        throw new \InvalidArgumentException('The array $GLOBALS[\'TYPO3_LOADED_EXT\'] may not be modified.', 1361915596);
-    }
-
-    /**
-     * Offset to unset
-     *
-     * @link http://php.net/manual/en/arrayaccess.offsetunset.php
-     * @param mixed $offset The offset to unset.
-     * @throws \InvalidArgumentException
-     */
-    public function offsetUnset($offset)
-    {
-        throw new \InvalidArgumentException('The array $GLOBALS[\'TYPO3_LOADED_EXT\'] may not be modified.', 1361915610);
-    }
-
-    /**
-     * String representation of object
-     *
-     * @link http://php.net/manual/en/serializable.serialize.php
-     * @return string the string representation of the object or null
-     */
-    public function serialize()
-    {
-        return serialize($this->loadedExtensionArrayElementCache);
-    }
-
-    /**
-     * Constructs the object
-     *
-     * @link http://php.net/manual/en/serializable.unserialize.php
-     * @param string $serialized The string representation of the object.
-     * @return mixed the original value unserialized.
-     */
-    public function unserialize($serialized)
-    {
-        $this->loadedExtensionArrayElementCache = unserialize($serialized);
-    }
-
-    /**
-     * Count elements of an object
-     *
-     * @link http://php.net/manual/en/countable.count.php
-     * @return int The custom count as an integer.
-     */
-    public function count()
-    {
-        return count($this->packageManager->getActivePackages());
-    }
-
-    /**
-     * Return the current element
-     *
-     * @link http://php.net/manual/en/iterator.current.php
-     * @return mixed Can return any type.
-     */
-    public function current()
-    {
-        return $this->offsetGet($this->iteratorPosition);
-    }
-
-    /**
-     * Move forward to next element
-     *
-     * @link http://php.net/manual/en/iterator.next.php
-     */
-    public function next()
-    {
-        $packageKeys = array_keys($this->packageManager->getActivePackages());
-        $position = array_search($this->iteratorPosition, $packageKeys);
-        if (isset($packageKeys[$position + 1])) {
-            $this->iteratorPosition = $packageKeys[$position + 1];
-        } else {
-            $this->iteratorPosition = null;
-        }
-    }
-
-    /**
-     * Return the key of the current element
-     *
-     * @link http://php.net/manual/en/iterator.key.php
-     * @return mixed scalar on success, or null on failure.
-     */
-    public function key()
-    {
-        return $this->iteratorPosition;
-    }
-
-    /**
-     * Checks if current position is valid
-     *
-     * @link http://php.net/manual/en/iterator.valid.php
-     * @return bool The return value will be casted to boolean and then evaluated. Returns true on success or false on failure.
-     */
-    public function valid()
-    {
-        return $this->offsetExists($this->iteratorPosition);
-    }
-
-    /**
-     * Rewind the Iterator to the first element
-     *
-     * @link http://php.net/manual/en/iterator.rewind.php
-     */
-    public function rewind()
-    {
-        $keys = array_keys($this->packageManager->getActivePackages());
-        $this->iteratorPosition = array_shift($keys);
-    }
-
-    /**
-     * Reset
-     */
-    public function reset()
-    {
-        $this->loadedExtensionArrayElementCache = [];
-        $this->rewind();
-    }
-
-    /**
-     * Whether package manager is set in class
-     *
-     * @return bool TRUE if package manager is set
-     */
-    public function hasPackageManager()
-    {
-        return $this->packageManager !== null;
-    }
-
-    /**
-     * @return array
-     */
-    public function toArray()
-    {
-        return array_map(
-            function ($loadedExtElement) {
-                return $loadedExtElement->toArray();
-            },
-            iterator_to_array($this)
-        );
-    }
-}
index d5373aa..6ed5988 100644 (file)
@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Core\Package;
 use Symfony\Component\Finder\Finder;
 use Symfony\Component\Finder\SplFileInfo;
 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
-use TYPO3\CMS\Core\Compatibility\LoadedExtensionArrayElement;
 use TYPO3\CMS\Core\Core\ClassLoadingInformation;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Service\DependencyOrderingService;
@@ -146,8 +145,6 @@ class PackageManager implements SingletonInterface
         } catch (Exception\PackageManagerCacheUnavailableException $exception) {
             $this->loadPackageStates();
             $this->initializePackageObjects();
-            // @deprecated will be removed in TYPO3 v10.0
-            $this->initializeCompatibilityLoadedExtArray();
             $this->saveToPackageCache();
         }
     }
@@ -188,8 +185,6 @@ class PackageManager implements SingletonInterface
             $packageCache = [
                 'packageStatesConfiguration' => $this->packageStatesConfiguration,
                 'packageAliasMap' => $this->packageAliasMap,
-                // @deprecated will be removed in TYPO3 v10.0
-                'loadedExtArray' => $GLOBALS['TYPO3_LOADED_EXT'],
                 'composerNameToPackageKeyMap' => $this->composerNameToPackageKeyMap,
                 'packageObjects' => serialize($this->packages),
             ];
@@ -225,8 +220,6 @@ class PackageManager implements SingletonInterface
                 \stdClass::class,
             ]
         ]);
-        // @deprecated will be removed in TYPO3 v10.0
-        $GLOBALS['TYPO3_LOADED_EXT'] = $packageCache['loadedExtArray'];
     }
 
     /**
@@ -301,16 +294,6 @@ class PackageManager implements SingletonInterface
     }
 
     /**
-     * Initializes a backwards compatibility $GLOBALS['TYPO3_LOADED_EXT'] array
-     */
-    protected function initializeCompatibilityLoadedExtArray()
-    {
-        // @deprecated will be removed in TYPO3 v10.0
-        $loadedExtObj = new \TYPO3\CMS\Core\Compatibility\LoadedExtensionsArray($this);
-        $GLOBALS['TYPO3_LOADED_EXT'] = $loadedExtObj->toArray();
-    }
-
-    /**
      * Scans all directories in the packages directories for available packages.
      * For each package a Package object is created and stored in $this->packages.
      * @internal
@@ -616,11 +599,6 @@ class PackageManager implements SingletonInterface
     {
         $package = $this->registerPackageDuringRuntime($packageKey);
         $this->runtimeActivatedPackages[$package->getPackageKey()] = $package;
-        // @deprecated will be removed in TYPO3 v10.0
-        if (!isset($GLOBALS['TYPO3_LOADED_EXT'][$package->getPackageKey()])) {
-            $loadedExtArrayElement = new LoadedExtensionArrayElement($package);
-            $GLOBALS['TYPO3_LOADED_EXT'][$package->getPackageKey()] = $loadedExtArrayElement->toArray();
-        }
         $this->registerTransientClassLoadingInformationForPackage($package);
     }
 
@@ -797,9 +775,6 @@ class PackageManager implements SingletonInterface
         $packageStatesCode = "<?php\n$fileDescription\nreturn " . ArrayUtility::arrayExport($this->packageStatesConfiguration) . ";\n";
         GeneralUtility::writeFile($this->packageStatesPathAndFilename, $packageStatesCode, true);
 
-        // @deprecated will be removed in TYPO3 v10.0
-        $this->initializeCompatibilityLoadedExtArray();
-
         GeneralUtility::makeInstance(OpcodeCacheService::class)->clearAllActive($this->packageStatesPathAndFilename);
     }
 
index c3b6351..13a52d4 100644 (file)
@@ -194,6 +194,10 @@ The following language files and aliases have been removed:
 * :php:`EXT:saltedpasswords/Resources/Private/Language/locallang_em.xlf`
 
 
+The following global variables have been removed:
+
+* :php:`$GLOBALS['TYPO3_LOADED_EXT']`
+
 Impact
 ======
 
index fb7d6d6..8062110 100644 (file)
@@ -23,6 +23,7 @@ return [
     '$GLOBALS[\'TYPO3_LOADED_EXT\']' => [
         'restFiles' => [
             'Deprecation-86404-GLOBALSTYPO3_LOADED_EXT.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
 ];
index ff486ff..3c054ff 100644 (file)
@@ -62,12 +62,6 @@ class ConfigurationController
             'type' => 'global',
             'globalKey' => 'TCA_DESCR',
         ],
-        // @deprecated will be removed in TYPO3 v10.0
-        'loadedExt' => [
-            'label' => 'loadedExt',
-            'type' => 'global',
-            'globalKey' => 'TYPO3_LOADED_EXT',
-        ],
         'services' => [
             'label' => 't3services',
             'key' => 'services',
index 6a5e1ed..8888bfc 100644 (file)
@@ -15,9 +15,6 @@
                        <trans-unit id="tcaDescr">
                                <source>$GLOBALS['TCA_DESCR'] (Table Help Description)</source>
                        </trans-unit>
-                       <trans-unit id="loadedExt">
-                               <source>$GLOBALS['TYPO3_LOADED_EXT'] (Loaded Extensions)</source>
-                       </trans-unit>
                        <trans-unit id="tbeStyles">
                                <source>$GLOBALS['TBE_STYLES'] (Skinning Styles)</source>
                        </trans-unit>