[!!!][TASK] Remove words and words_strings from ReferenceIndex 10/35310/6
authorStephan Großberndt <stephan@grossberndt.de>
Thu, 11 Dec 2014 15:13:14 +0000 (16:13 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 12 Dec 2014 11:43:15 +0000 (12:43 +0100)
In ReferenceIndex->generateRefIndexData the strings from all input and
text fields were collected in $this->word_strings. But the array was
never accessed. Remove ReferenceIndex->words (unused) and
ReferenceIndex->word_strings and the collection of word_strings. This
greatly reduces memory usage when bulk inserting or editing records as
well as updating the reference index.

Resolves: #63780
Releases: master, 6.2
Change-Id: I56d6a3e615cab44cbecff5a7d4dec42a1da29fc6
Reviewed-on: http://review.typo3.org/35310
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Database/ReferenceIndex.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-63780-RemoveWordStringsFromReferenceIndex.rst [new file with mode: 0644]

index 498a633..f2b3e35 100644 (file)
@@ -52,16 +52,6 @@ class ReferenceIndex {
        public $relations = array();
 
        /**
-        * @var array
-        */
-       public $words_strings = array();
-
-       /**
-        * @var array
-        */
-       public $words = array();
-
-       /**
         * Number which we can increase if a change in the code means we will have to force a re-generation of the index.
         *
         * @var int
@@ -165,9 +155,6 @@ class ReferenceIndex {
                        // Get raw record from DB:
                        $record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', $table, 'uid=' . (int)$uid);
                        if (is_array($record)) {
-                               // Initialize:
-                               $this->words_strings = array();
-                               $this->words = array();
                                // Deleted:
                                $deleted = $GLOBALS['TCA'][$table]['ctrl']['delete'] && $record[$GLOBALS['TCA'][$table]['ctrl']['delete']] ? 1 : 0;
                                // Get all relations from record:
@@ -212,12 +199,6 @@ class ReferenceIndex {
                                                $this->createEntryData_softreferences($table, $uid, $fieldname, '', $deleted, $dat['softrefs']['keys']);
                                        }
                                }
-                               // Word indexing:
-                               foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $conf) {
-                                       if (GeneralUtility::inList('input,text', $conf['config']['type']) && (string)$record[$field] !== '' && !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($record[$field])) {
-                                               $this->words_strings[$field] = $record[$field];
-                                       }
-                               }
                                return $this->relations;
                        }
                }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-63780-RemoveWordStringsFromReferenceIndex.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-63780-RemoveWordStringsFromReferenceIndex.rst
new file mode 100644 (file)
index 0000000..9c099bb
--- /dev/null
@@ -0,0 +1,30 @@
+======================================================================================
+Breaking: #63780 - Remove public properties words and word_strings from ReferenceIndex
+======================================================================================
+
+Description
+===========
+
+Public properties words and word_strings are removed from class \TYPO3\CMS\Core\Database\ReferenceIndex.
+ReferenceIndex->words was always an empty array and ReferenceIndex->word_strings contained string from
+input and text field of every record that was given to this class instance.
+
+
+Impact
+======
+
+An extension relying on one of the public properties to be there will fail.
+
+
+Affected installations
+======================
+
+It is unlikely that any extension used property words or word_strings. An instance could be
+checked by searching for usages of class ReferenceIndex.
+
+
+Migration
+=========
+
+The according logic needs to be re-implemented in the extension that used the content of these
+properties.