[TASK] Performance: Avoid using array_keys in foreach 73/35373/8
authorMathias Schreiber <mathias.schreiber@wmdb.de>
Mon, 29 Dec 2014 08:39:57 +0000 (09:39 +0100)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Mon, 29 Dec 2014 18:41:26 +0000 (19:41 +0100)
This lowers the memory usage.

Iterate on the original array instead of an array_keys()-copy
which lowers memory usage and enhances performance.

Change-Id: If65fae1665e242667d621f086a55a22a8d5309ed
Resolves: #64004
Releases: master, 6.2
Reviewed-on: http://review.typo3.org/35373
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
22 files changed:
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/core/Classes/Cache/Backend/TransientMemoryBackend.php
typo3/sysext/core/Classes/Cache/CacheManager.php
typo3/sysext/core/Classes/Category/CategoryRegistry.php
typo3/sysext/core/Classes/Core/ClassLoader.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/Package/DependencyResolver.php
typo3/sysext/core/Classes/Package/PackageManager.php
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/core/Classes/Utility/ArrayUtility.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageManager.php
typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php
typo3/sysext/core/Tests/Unit/Resource/FileReferenceTest.php
typo3/sysext/extensionmanager/Classes/Utility/ListUtility.php
typo3/sysext/fluid/Classes/Core/Parser/TemplateParser.php
typo3/sysext/impexp/Classes/ImportExport.php
typo3/sysext/recycler/Classes/Domain/Model/Tables.php
typo3/sysext/rtehtmlarea/Classes/Hook/Install/DeprecatedRteProperties.php
typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php
typo3/sysext/workspaces/Classes/Service/AdditionalColumnService.php

index 5c3c528..b64c360 100644 (file)
@@ -2027,7 +2027,7 @@ class FormEngine {
                        $type = $fieldConfig['type'];
                        if (is_array($TSconfig['config']) && is_array($this->allowOverrideMatrix[$type])) {
                                // Check if the keys in TSconfig['config'] are allowed to override TCA field config:
-                               foreach (array_keys($TSconfig['config']) as $key) {
+                               foreach ($TSconfig['config'] as $key => $_) {
                                        if (!in_array($key, $this->allowOverrideMatrix[$type], TRUE)) {
                                                unset($TSconfig['config'][$key]);
                                        }
@@ -3341,8 +3341,7 @@ class FormEngine {
                        $languageService = $this->getLanguageService();
                        switch ($fieldValue['config']['special']) {
                                case 'tables':
-                                       $temp_tc = array_keys($GLOBALS['TCA']);
-                                       foreach ($temp_tc as $theTableNames) {
+                                       foreach ($GLOBALS['TCA'] as $theTableNames => $_) {
                                                if (!$GLOBALS['TCA'][$theTableNames]['ctrl']['adminOnly']) {
                                                        // Icon:
                                                        $icon = IconUtility::mapRecordTypeToSpriteIconName($theTableNames, array());
index 2de5eed..6115139 100644 (file)
@@ -126,7 +126,7 @@ class BackendUtility {
                        $row = self::getRecord($table, $uid, $internalFields, $where, $useDeleteClause);
                        self::workspaceOL($table, $row, -99, $unsetMovePointers);
                        if (is_array($row)) {
-                               foreach (array_keys($row) as $key) {
+                               foreach ($row as $key => $_) {
                                        if (!GeneralUtility::inList($fields, $key) && $key[0] !== '_') {
                                                unset($row[$key]);
                                        }
@@ -479,13 +479,12 @@ class BackendUtility {
        static public function getExcludeFields() {
                $finalExcludeArray = array();
 
-               // All TCA keys
-               $tableNamesFromTca = array_keys($GLOBALS['TCA']);
                // Fetch translations for table names
                $tableToTranslation = array();
                $lang = static::getLanguageService();
-               foreach ($tableNamesFromTca as $table) {
-                       $tableToTranslation[$table] = $lang->sl($GLOBALS['TCA'][$table]['ctrl']['title']);
+               // All TCA keys
+               foreach ($GLOBALS['TCA'] as $table => $conf) {
+                       $tableToTranslation[$table] = $lang->sl($conf['ctrl']['title']);
                }
                // Sort by translations
                asort($tableToTranslation);
@@ -497,8 +496,7 @@ class BackendUtility {
                                        && empty($GLOBALS['TCA'][$table]['ctrl']['adminOnly'])
                                        && (empty($GLOBALS['TCA'][$table]['ctrl']['rootLevel']) || !empty($GLOBALS['TCA'][$table]['ctrl']['security']['ignoreRootLevelRestriction']))
                        ) {
-                               $fieldKeys = array_keys($GLOBALS['TCA'][$table]['columns']);
-                               foreach ($fieldKeys as $field) {
+                               foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $_) {
                                        if ($GLOBALS['TCA'][$table]['columns'][$field]['exclude']) {
                                                // Get human readable names of fields
                                                $translatedField = $lang->sl($GLOBALS['TCA'][$table]['columns'][$field]['label']);
@@ -560,12 +558,10 @@ class BackendUtility {
                );
                // All TCA keys:
                $allowDenyOptions = array();
-               $tc_keys = array_keys($GLOBALS['TCA']);
-               foreach ($tc_keys as $table) {
+               foreach ($GLOBALS['TCA'] as $table => $_) {
                        // All field names configured:
                        if (is_array($GLOBALS['TCA'][$table]['columns'])) {
-                               $f_keys = array_keys($GLOBALS['TCA'][$table]['columns']);
-                               foreach ($f_keys as $field) {
+                               foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $_) {
                                        $fCfg = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
                                        if ($fCfg['type'] == 'select' && $fCfg['authMode']) {
                                                // Check for items:
@@ -1980,7 +1976,7 @@ class BackendUtility {
 
                $originalTable = self::getOriginalTranslationTable($table);
                $originalRow = self::getRecord($originalTable, $row[$originalUidField]);
-               foreach (array_keys($row) as $field) {
+               foreach ($row as $field => $_) {
                        $l10n_mode = isset($GLOBALS['TCA'][$originalTable]['columns'][$field]['l10n_mode'])
                                ? $GLOBALS['TCA'][$originalTable]['columns'][$field]['l10n_mode']
                                : '';
index 9da3d9d..f31f0c2 100644 (file)
@@ -91,7 +91,7 @@ class TransientMemoryBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBacke
        public function remove($entryIdentifier) {
                if (isset($this->entries[$entryIdentifier])) {
                        unset($this->entries[$entryIdentifier]);
-                       foreach (array_keys($this->tagsAndEntries) as $tag) {
+                       foreach ($this->tagsAndEntries as $tag => $_) {
                                if (isset($this->tagsAndEntries[$tag][$entryIdentifier])) {
                                        unset($this->tagsAndEntries[$tag][$entryIdentifier]);
                                }
index e49de5d..cb5b425 100644 (file)
@@ -258,7 +258,7 @@ class CacheManager implements \TYPO3\CMS\Core\SingletonInterface {
                                $flushDoctrineProxyCache = FALSE;
                                if (count($modifiedClassNamesWithUnderscores) > 0) {
                                        $reflectionStatusCache = $this->getCache('FLOW3_Reflection_Status');
-                                       foreach (array_keys($modifiedClassNamesWithUnderscores) as $classNameWithUnderscores) {
+                                       foreach ($modifiedClassNamesWithUnderscores as $classNameWithUnderscores => $_) {
                                                $reflectionStatusCache->remove($classNameWithUnderscores);
                                                if ($flushDoctrineProxyCache === FALSE && preg_match('/_Domain_Model_(.+)/', $classNameWithUnderscores) === 1) {
                                                        $flushDoctrineProxyCache = TRUE;
@@ -278,7 +278,7 @@ class CacheManager implements \TYPO3\CMS\Core\SingletonInterface {
                        case 'FLOW3_ConfigurationFiles':
                                $policyChangeDetected = FALSE;
                                $routesChangeDetected = FALSE;
-                               foreach (array_keys($changedFiles) as $pathAndFilename) {
+                               foreach ($changedFiles as $pathAndFilename => $_) {
                                        $filename = basename($pathAndFilename);
                                        if (!in_array($filename, array('Policy.yaml', 'Routes.yaml'))) {
                                                continue;
@@ -337,7 +337,7 @@ class CacheManager implements \TYPO3\CMS\Core\SingletonInterface {
         * @return void
         */
        protected function createAllCaches() {
-               foreach (array_keys($this->cacheConfigurations) as $identifier) {
+               foreach ($this->cacheConfigurations as $identifier => $_) {
                        if (!isset($this->caches[$identifier])) {
                                $this->createCache($identifier);
                        }
index 1ac36f5..b7870ec 100644 (file)
@@ -209,7 +209,7 @@ class CategoryRegistry implements \TYPO3\CMS\Core\SingletonInterface {
        public function applyTcaForPreRegisteredTables() {
                $this->registerDefaultCategorizedTables();
                foreach ($this->registry as $tableName => $fields) {
-                       foreach (array_keys($fields) as $fieldName) {
+                       foreach ($fields as $fieldName => $_) {
                                $this->applyTcaForTableAndField($tableName, $fieldName);
                        }
                }
index c21dbe2..7b7ba96 100644 (file)
@@ -612,7 +612,7 @@ class ClassLoader {
         */
        protected function buildPackageClassPathsForLegacyExtension(PackageInterface $package) {
                $this->packageClassesPaths[$package->getPackageKey()] = $package->getClassesPath();
-               foreach (array_keys($package->getPackageReplacementKeys()) as $packageToReplace) {
+               foreach ($package->getPackageReplacementKeys() as $packageToReplace => $_) {
                        $this->packageClassesPaths[$packageToReplace] = $package->getClassesPath();
                }
        }
index 9a593c6..2bf69c7 100644 (file)
@@ -2852,7 +2852,7 @@ class DataHandler {
                }
                $pasteDatamap = array();
                // Traverse command map:
-               foreach (array_keys($this->cmdmap) as $table) {
+               foreach ($this->cmdmap as $table => $_) {
                        // Check if the table may be modified!
                        $modifyAccessList = $this->checkModifyAccessList($table);
                        if (!$modifyAccessList) {
@@ -4422,7 +4422,7 @@ class DataHandler {
        public function deleteSpecificPage($uid, $forceHardDelete = FALSE) {
                $uid = (int)$uid;
                if ($uid) {
-                       foreach (array_keys($GLOBALS['TCA']) as $table) {
+                       foreach ($GLOBALS['TCA'] as $table => $_) {
                                if ($table != 'pages') {
                                        $mres = $this->databaseConnection->exec_SELECTquery('uid', $table, 'pid=' . (int)$uid . $this->deleteClause($table));
                                        while ($row = $this->databaseConnection->sql_fetch_assoc($mres)) {
@@ -5685,7 +5685,7 @@ class DataHandler {
         */
        public function getExcludeListArray() {
                $list = array();
-               foreach (array_keys($GLOBALS['TCA']) as $table) {
+               foreach ($GLOBALS['TCA'] as $table => $_) {
                        if (isset($GLOBALS['TCA'][$table]['columns'])) {
                                foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $config) {
                                        if ($config['exclude'] && !GeneralUtility::inList($this->BE_USER->groupData['non_exclude_fields'], ($table . ':' . $field))) {
@@ -5718,7 +5718,7 @@ class DataHandler {
                        return FALSE;
                }
                $tableList = array();
-               foreach (array_keys($GLOBALS['TCA']) as $table) {
+               foreach ($GLOBALS['TCA'] as $table => $_) {
                        // If the table is not in the allowed list, check if there are records...
                        if (!in_array($table, $allowedArray, TRUE)) {
                                $count = $this->databaseConnection->exec_SELECTcountRows('uid', $table, 'pid=' . (int)$page_uid);
@@ -6781,7 +6781,7 @@ class DataHandler {
        public function noRecordsFromUnallowedTables($inList) {
                $inList = trim($this->rmComma(trim($inList)));
                if ($inList && !$this->admin) {
-                       foreach (array_keys($GLOBALS['TCA']) as $table) {
+                       foreach ($GLOBALS['TCA'] as $table => $_) {
                                $count = $this->databaseConnection->exec_SELECTcountRows('uid', $table, 'pid IN (' . $inList . ')' . BackendUtility::deleteClause($table));
                                if ($count && ($this->tableReadOnly($table) || !$this->checkModifyAccessList($table))) {
                                        return FALSE;
@@ -6925,7 +6925,7 @@ class DataHandler {
 
                /** @var \TYPO3\CMS\Core\Cache\CacheManager $cacheManager */
                $cacheManager = $this->getCacheManager();
-               foreach ($tagsToClear as $tag => $unusedValue) {
+               foreach ($tagsToClear as $tag => $_) {
                        $cacheManager->flushCachesInGroupByTag('pages', $tag);
                }
 
index f3556ea..424b6cd 100644 (file)
@@ -52,7 +52,7 @@ class DependencyResolver {
 
                // Filter extensions with no incoming edge
                $rootPackageKeys = array();
-               foreach (array_keys($dependencyGraph) as $packageKey) {
+               foreach ($dependencyGraph as $packageKey => $_) {
                        if (!$this->getIncomingEdgeCount($dependencyGraph, $packageKey)) {
                                $rootPackageKeys[] = $packageKey;
                        }
@@ -66,8 +66,7 @@ class DependencyResolver {
                        $currentPackageKey = array_shift($rootPackageKeys);
                        array_push($sortedPackageKeys, $currentPackageKey);
 
-                       $dependingPackageKeys = array_keys(array_filter($dependencyGraph[$currentPackageKey]));
-                       foreach ($dependingPackageKeys as $dependingPackageKey) {
+                       foreach (array_filter($dependencyGraph[$currentPackageKey]) as $dependingPackageKey => $_) {
                                // Remove the edge to this dependency
                                $dependencyGraph[$currentPackageKey][$dependingPackageKey] = FALSE;
                                if (!$this->getIncomingEdgeCount($dependencyGraph, $dependingPackageKey)) {
@@ -174,7 +173,7 @@ class DependencyResolver {
         * @return array Nodes of the found path; empty if no path is found
         */
        protected function findPathInGraph(array $graph, $from, $to) {
-               foreach (array_keys(array_filter($graph[$from])) as $node) {
+               foreach (array_filter($graph[$from]) as $node => $_) {
                        if ($node === $to) {
                                return array($from, $to);
                        } else {
@@ -200,7 +199,7 @@ class DependencyResolver {
         */
        protected function addDependencyToFrameworkToAllExtensions(array $packageStateConfiguration, array $dependencyGraph) {
                $rootPackageKeys = array();
-               foreach (array_keys($dependencyGraph) as $packageKey) {
+               foreach ($dependencyGraph as $packageKey => $_) {
                        if (!$this->getIncomingEdgeCount($dependencyGraph, $packageKey)) {
                                $rootPackageKeys[] = $packageKey;
                        }
index 52fec28..cb5ed29 100644 (file)
@@ -707,7 +707,7 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
 
                // Reorder the packages according to the loading order
                $newPackages = array();
-               foreach (array_keys($this->packageStatesConfiguration['packages']) as $packageKey) {
+               foreach ($this->packageStatesConfiguration['packages'] as $packageKey => $_) {
                        $newPackages[$packageKey] = $this->packages[$packageKey];
                }
                $this->packages = $newPackages;
index 1b24e98..b56f1c7 100644 (file)
@@ -2303,7 +2303,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
         */
        protected function addAjaxUrlsToInlineSettings() {
                $ajaxUrls = array();
-               foreach (array_keys($GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']) as $ajaxHandler) {
+               foreach ($GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX'] as $ajaxHandler => $_) {
                        $ajaxUrls[$ajaxHandler] = BackendUtility::getAjaxUrl($ajaxHandler);
                }
                $this->inlineSettings['ajaxUrls'] = $ajaxUrls;
@@ -2912,4 +2912,4 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                }
        }
 
-}
\ No newline at end of file
+}
index 2c64f54..e49e2cb 100644 (file)
@@ -432,8 +432,7 @@ class ArrayUtility {
         */
        public static function intersectRecursive(array $source, array $mask = array()) {
                $intersection = array();
-               $sourceArrayKeys = array_keys($source);
-               foreach ($sourceArrayKeys as $key) {
+               foreach ($source as $key => $_) {
                        if (!array_key_exists($key, $mask)) {
                                continue;
                        }
@@ -477,7 +476,7 @@ class ArrayUtility {
        static public function renumberKeysToAvoidLeapsIfKeysAreAllNumeric(array $array = array(), $level = 0) {
                $level++;
                $allKeysAreNumeric = TRUE;
-               foreach (array_keys($array) as $key) {
+               foreach ($array as $key => $_) {
                        if (is_numeric($key) === FALSE) {
                                $allKeysAreNumeric = FALSE;
                                break;
@@ -517,7 +516,7 @@ class ArrayUtility {
         * @return void
         */
        static public function mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) {
-               foreach ($overrule as $key => $unusedValue) {
+               foreach ($overrule as $key => $_) {
                        if ($enableUnsetFeature && $overrule[$key] === '__UNSET') {
                                unset($original[$key]);
                                continue;
index d58ac0c..38a4496 100644 (file)
@@ -367,7 +367,7 @@ class ExtensionManagementUtility {
                        $types = &$GLOBALS['TCA'][$table]['types'];
                        if (is_array($types)) {
                                // Iterate through all types and search for the field that defines the palette to be extended:
-                               foreach (array_keys($types) as $type) {
+                               foreach ($types as $type => $_) {
                                        $items = self::explodeItemList($types[$type]['showitem']);
                                        if (isset($items[$field])) {
                                                // If the field already has a palette, extend it:
@@ -1796,7 +1796,7 @@ tt_content.' . $key . $prefix . ' {
        static public function loadNewTcaColumnsConfigFiles() {
                global $TCA;
 
-               foreach (array_keys($TCA) as $tableName) {
+               foreach ($TCA as $tableName => $_) {
                        if (!isset($TCA[$tableName]['columns'])) {
                                $columnsConfigFile = $TCA[$tableName]['ctrl']['dynamicConfigFile'];
                                if ($columnsConfigFile) {
index 5b3bd0f..5c230ac 100644 (file)
@@ -451,7 +451,7 @@ class PackageManager implements \TYPO3\Flow\Package\PackageManagerInterface {
                $package = $this->packageFactory->create($this->packagesBasePath, $packagePath, $packageKey, PackageInterface::DIRECTORY_CLASSES);
 
                $this->packages[$packageKey] = $package;
-               foreach (array_keys($this->packages) as $upperCamelCasedPackageKey) {
+               foreach ($this->packages as $upperCamelCasedPackageKey => $_) {
                        $this->packageKeys[strtolower($upperCamelCasedPackageKey)] = $upperCamelCasedPackageKey;
                }
 
index 23bc2dd..9a402f5 100644 (file)
@@ -718,7 +718,7 @@ class FunctionalTestCaseBootstrapUtility {
         * @return void
         */
        protected function mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) {
-               foreach (array_keys($overrule) as $key) {
+               foreach ($overrule as $key => $_) {
                        if ($enableUnsetFeature && $overrule[$key] === '__UNSET') {
                                unset($original[$key]);
                                continue;
index f2d9c2f..2a860e8 100644 (file)
@@ -103,7 +103,7 @@ class FileReferenceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function hasPropertyReturnsTrueForAllMergedPropertyKeys($fileReferenceProperties, $originalFileProperties, $expectedMergedProperties) {
                $fixture = $this->prepareFixture($fileReferenceProperties, $originalFileProperties);
-               foreach (array_keys($expectedMergedProperties) as $key) {
+               foreach ($expectedMergedProperties as $key => $_) {
                        $this->assertTrue($fixture->hasProperty($key));
                }
        }
index 9de830e..9a1a2ba 100644 (file)
@@ -114,7 +114,7 @@ class ListUtility implements \TYPO3\CMS\Core\SingletonInterface {
         * @return array
         */
        public function getAvailableAndInstalledExtensions(array $availableExtensions) {
-               foreach (array_keys($this->packageManager->getActivePackages()) as $extKey) {
+               foreach ($this->packageManager->getActivePackages() as $extKey => $_) {
                        if (isset($availableExtensions[$extKey])) {
                                $availableExtensions[$extKey]['installed'] = TRUE;
                        }
index df3729e..d0d7171 100644 (file)
@@ -530,7 +530,7 @@ class TemplateParser {
                        $expectedArgumentNames[] = $expectedArgument->getName();
                }
 
-               foreach (array_keys($actualArguments) as $argumentName) {
+               foreach ($actualArguments as $argumentName => $_) {
                        if (!in_array($argumentName, $expectedArgumentNames)) {
                                throw new \TYPO3\CMS\Fluid\Core\Parser\Exception('Argument "' . $argumentName . '" was not registered.', 1237823695);
                        }
index 9daddea..fabf0c6 100644 (file)
@@ -976,7 +976,7 @@ class ImportExport {
                if (!isset($this->dat['header']['records']['sys_file']) || !is_array($this->dat['header']['records']['sys_file'])) {
                        return;
                }
-               foreach (array_keys($this->dat['header']['records']['sys_file']) as $sysFileUid) {
+               foreach ($this->dat['header']['records']['sys_file'] as $sysFileUid => $_) {
                        $recordData = $this->dat['records']['sys_file:' . $sysFileUid]['data'];
                        $file = ResourceFactory::getInstance()->createFileObject($recordData);
                        $this->export_addSysFile($file);
@@ -1529,7 +1529,7 @@ class ImportExport {
                        return;
                }
                $sysFileStorageUidsToBeResetToDefaultStorage = array();
-               foreach (array_keys($this->dat['header']['records']['sys_file_storage']) as $sysFileStorageUid) {
+               foreach ($this->dat['header']['records']['sys_file_storage'] as $sysFileStorageUid => $_) {
                        $storageRecord = $this->dat['records']['sys_file_storage:' . $sysFileStorageUid]['data'];
                        // continue with Local, writable and online storage only
                        if ($storageRecord['driver'] === 'Local' && $storageRecord['is_writable'] && $storageRecord['is_online']) {
@@ -1610,7 +1610,7 @@ class ImportExport {
 
                $sanitizedFolderMappings = array();
 
-               foreach (array_keys($this->dat['header']['records']['sys_file']) as $sysFileUid) {
+               foreach ($this->dat['header']['records']['sys_file'] as $sysFileUid => $_) {
                        $fileRecord = $this->dat['records']['sys_file:' . $sysFileUid]['data'];
 
                        $temporaryFile = NULL;
@@ -1746,7 +1746,7 @@ class ImportExport {
                        return;
                }
 
-               foreach (array_keys($this->dat['header']['records']['sys_file_reference']) as $sysFileReferenceUid) {
+               foreach ($this->dat['header']['records']['sys_file_reference'] as $sysFileReferenceUid => $_) {
                        $fileReferenceRecord = $this->dat['records']['sys_file_reference:' . $sysFileReferenceUid]['data'];
                        if ($fileReferenceRecord['uid_local'] == $oldFileUid) {
                                $fileReferenceRecord['uid_local'] = $newFileUid;
index b3c6e23..59429a5 100644 (file)
@@ -55,7 +55,7 @@ class Tables {
        public function getTables($format, $withAllOption = TRUE, $startUid, $depth = 0) {
                $deletedRecordsTotal = 0;
                $tables = array();
-               foreach (array_keys($GLOBALS['TCA']) as $tableName) {
+               foreach ($GLOBALS['TCA'] as $tableName => $_) {
                        $deletedField = RecyclerUtility::getDeletedField($tableName);
                        if ($deletedField) {
                                // Determine whether the table has deleted records:
index d8b97db..2d13ab1 100644 (file)
@@ -135,7 +135,10 @@ class DeprecatedRteProperties extends AbstractUpdate {
                                $description .= '<p>This wizard will perform automatic replacement of the following properties on <strong>' . strval(count($updateablePages)) . '&nbsp;pages</strong> (including deleted and hidden):</p>' . LF . '<table><thead><tr><th>Deprecated property</th><th>Will be replaced by</th></tr></thead><tbody>' . $replacementProperties . '</tboby></table>' . LF . '<p>The Page TSconfig column of the remaining pages will need to be updated manually.</p>' . LF;
                        } else {
                                $replacementProperties = '';
-                               foreach (array_keys(array_merge($this->useInsteadRteProperties, $this->doubleReplacementRteProperties)) as $deprecatedProperty) {
+                               foreach ($this->useInsteadRteProperties as $deprecatedProperty => $_) {
+                                       $replacementProperties .= '<tr><td>' . $deprecatedProperty . '</td></tr>' . LF;
+                               }
+                               foreach ($this->doubleReplacementRteProperties as $deprecatedProperty => $_) {
                                        $replacementProperties .= '<tr><td>' . $deprecatedProperty . '</td></tr>' . LF;
                                }
                                $description .= '<p>This wizard cannot update the following properties, some of which are present on those pages:</p>' . LF . '<table><thead><tr><th>Deprecated property</th></tr></thead><tbody>' . $replacementProperties . '</tboby></table>' . LF . '<p>Therefore, the Page TSconfig column of those pages will need to be updated manually.</p>' . LF;
@@ -202,9 +205,8 @@ class DeprecatedRteProperties extends AbstractUpdate {
        protected function getPagesWithDeprecatedRteProperties(&$dbQueries, &$customMessages) {
                $fields = 'uid, TSconfig';
                $table = 'pages';
-               $deprecatedRteProperties = array_keys(array_merge($this->replacementRteProperties, $this->useInsteadRteProperties, $this->doubleReplacementRteProperties));
                $where = '';
-               foreach ($deprecatedRteProperties as $deprecatedRteProperty) {
+               foreach (array_merge($this->replacementRteProperties, $this->useInsteadRteProperties, $this->doubleReplacementRteProperties) as $deprecatedRteProperty => $_) {
                        $where .= ($where ? ' OR ' : '') . '(TSConfig LIKE BINARY "%RTE.%' . $deprecatedRteProperty . '%" AND TSConfig NOT LIKE BINARY "%RTE.%' . $deprecatedRteProperty . 's%") ';
                }
                $db = $this->getDatabaseConnection();
index 591603f..479342c 100644 (file)
@@ -91,7 +91,7 @@ class DataHandlerHook {
                                $where .= BackendUtility::deleteClause($tcaTable);
                                $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', $tcaTable, $where, '', '', '', 'uid');
                                if (is_array($records)) {
-                                       foreach (array_keys($records) as $recordId) {
+                                       foreach ($records as $recordId => $_) {
                                                $command[$tcaTable][$recordId]['version']['action'] = 'flush';
                                        }
                                }
index 40f2db9..0a22cae 100644 (file)
@@ -90,7 +90,7 @@ class AdditionalColumnService implements \TYPO3\CMS\Core\SingletonInterface {
         */
        public function getHandler() {
                $columnSettings = array();
-               foreach (array_keys($this->columns) as $columnName) {
+               foreach ($this->columns as $columnName => $_) {
                        $columnSettings[] = 'TYPO3.Workspaces.extension.AdditionalColumn.' . $columnName;
                }
                return $columnSettings;