Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save brannow/20420c9b7ad54faeec57b30aa4364b87 to your computer and use it in GitHub Desktop.
Save brannow/20420c9b7ad54faeec57b30aa4364b87 to your computer and use it in GitHub Desktop.
TYPO3 8.7 IRRE Performance Increase
Index: cms/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectItems.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- cms/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectItems.php (revision )
+++ cms/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectItems.php (revision )
@@ -43,6 +43,11 @@
continue;
}
+ // Make sure we only processing useful dataFields
+ if ($this->isSkippableDataField($result, $fieldName)) {
+ continue;
+ }
+
$fieldConfig['config']['items'] = $this->sanitizeItemArray($fieldConfig['config']['items'], $table, $fieldName);
$fieldConfig['config']['maxitems'] = MathUtility::forceIntegerInRange($fieldConfig['config']['maxitems'], 0, 99999);
if ($fieldConfig['config']['maxitems'] === 0) {
@@ -106,6 +111,53 @@
return $result;
}
+ /**
+ * checked if the Field can be skipped
+ *
+ * * skip multi language mistakes
+ * * skip not visible IRRE content
+ *
+ * @param array $result The current result array.
+ * @param string $fieldName Current handle field name
+ * @return bool
+ */
+ private function isSkippableDataField(array $result, string $fieldName): bool
+ {
+ // look for a translation for this record although where on the default language (0)
+ if ($fieldName == 'l10n_parent') {
+ // get TCA language field name
+ $languageField = $result['processedTca']['ctrl']['languageField'];
+ $languageUids = $result['databaseRow'][$languageField];
+
+ // languageField can be an array or a scalar value (try to normalize it)
+ if (!is_array($languageUids)) {
+ $languageUids = [(int)$result['databaseRow'][$languageField]];
+ }
+
+ if (count($languageUids) == 1 && $languageUids[0] == 0) {
+ return true;
+ }
+ }
+
+ // is inline record
+ if (!empty($result['isInlineChild'])) {
+ // skip data loading for inline child's if there are closed
+ if (empty($result['isInlineChildExpanded']) && empty($result['isInlineAjaxOpeningContext'])) {
+ return true;
+ }
+
+ // skip data loading for inline child's if there are the parent relation fields
+ if (!empty($result['isInlineChildExpanded']) || !empty($result['isInlineAjaxOpeningContext'])) {
+ $inlineParentConfig = $result['inlineParentConfig'];
+ if ($inlineParentConfig && isset($inlineParentConfig['foreign_field']) && $inlineParentConfig['foreign_field'] == $fieldName) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
/**
* Add values that are currently listed in the database columns but not in the selectable items list
* back to the list.
@SC-cmarquardt
Copy link

Hi,
this one saved me a lot of trouble.
Did you try to get this upstream?

Kind regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment