Project

General

Profile

Actions

Feature #89100

closed

Disable reference TO excluded tableName in sys_refindex

Added by Claus Harup over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2019-09-06
Due date:
% Done:

100%

Estimated time:
PHP Version:
7.2
Tags:
Complexity:
Sprint Focus:

Description

When adding a signal to tell RefeferenceIndex.php to exclude a given tableName:

namespace MyVendor\MyExtension\Slot;

class ReferenceIndexSlot {

   /**
    * Exclude tables from ReferenceIndex which cannot contain a reference
    *
    * @param string $tableName Name of the table
    * @param bool &$excludeTable Reference to a boolean whether to exclude the table from ReferenceIndex or not
    */
   public function shouldExcludeTableFromReferenceIndex($tableName, &$excludeTable) {
      if ($tableName === 'tx_myextension_mytable') {
         $excludeTable = true;
      }
   }

}

.... the RefeferenceIndex.php still creates sys_refindexes TO 'tx_myextension_mytable'.

Suggestion in RefeferenceIndex.php:

    ....
    foreach ($relations as &$relation) {
        if (!is_array($relation)) {
            continue;
        }

        //If a tableName is disabled from sys_refindex remove the reference TO it too

        if ($this->shouldExcludeTableFromReferenceIndex($relation['ref_table'])) {
            continue;
        }

        $relation['hash'] = md5(implode('///', $relation) . '///' . $this->hashVersion);
        // First, check if already indexed and if so, unset that row (so in the end we know which rows to remove!)
        if (isset($currentRelationHashes[$relation['hash']])) {
            unset($currentRelationHashes[$relation['hash']]);
            $result['keptNodes']++;
            $relation['_ACTION'] = 'KEPT';
        } else {
            // If new, add it:
            if (!$testOnly) {
                $connection->insert('sys_refindex', $relation);
            }
            $result['addedNodes']++;
            $relation['_ACTION'] = 'ADDED';
        }
    }
    ....
Actions #1

Updated by Gerrit Code Review over 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65572

Actions #2

Updated by Gerrit Code Review over 3 years ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65566

Actions #3

Updated by Gerrit Code Review over 3 years ago

Patch set 2 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65566

Actions #4

Updated by Benni Mack over 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #5

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF