Skip to content

Commit

Permalink
[CLEANUP] Remove deprecated feature skipRecordsIfNoPageChange
Browse files Browse the repository at this point in the history
  • Loading branch information
vertexvaar committed Sep 9, 2016
1 parent 89ad0eb commit 96c5080
Showing 1 changed file with 6 additions and 49 deletions.
55 changes: 6 additions & 49 deletions Classes/Domain/Repository/CommonRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
use In2code\In2publishCore\Domain\Model\Record;
use In2code\In2publishCore\Domain\Model\RecordInterface;
use In2code\In2publishCore\Domain\Service\ReplaceMarkersService;
use In2code\In2publishCore\Utility\ArrayUtility;
use In2code\In2publishCore\Utility\DatabaseUtility;
use In2code\In2publishCore\Utility\FileUtility;
use TYPO3\CMS\Core\Database\DatabaseConnection;
Expand Down Expand Up @@ -471,59 +470,17 @@ public function enrichPageRecord(Record $record, array $excludedTableNames)
}
$recordIdentifier = $record->getIdentifier();
foreach ($this->tcaService->getAllTableNames($excludedTableNames) as $tableName) {
if (!$this->skipRecordRelation($tableName, $record)) {
if ($this->shouldSkipSearchingForRelatedRecordByTable($record, $tableName)) {
continue;
}
$previousTableName = $this->replaceTableName($tableName);
$record->addRelatedRecords($this->findByProperty('pid', $recordIdentifier));
$this->tableName = $previousTableName;
} else {
$this->logger->debug(
'Records in this page skipped because of "skipRecordsIfNoPageChange"',
array('page' => $recordIdentifier, 'tableName' => $tableName)
);
if ($this->shouldSkipSearchingForRelatedRecordByTable($record, $tableName)) {
continue;
}
$previousTableName = $this->replaceTableName($tableName);
$relatedRecords = $this->findByProperty('pid', $recordIdentifier);
$record->addRelatedRecords($relatedRecords);
$this->tableName = $previousTableName;
}
return $record;
}

/**
* Check if this content relation could be skipped by looking into the last sys_log entry for the current page and
* compare local and foreign. If there are no differences, relation could be skipped
*
* @param string $tableName
* @param Record $record
* @return bool
*/
protected function skipRecordRelation($tableName, Record $record)
{
if ($record->isPagesTable() && $tableName !== 'pages') {
// check if this test wasn't done before
if (!array_key_exists($record->getIdentifier(), $this->skipRecords)) {
$localLog = $this->findLastPropertiesByPropertyAndTableName(
$this->localDatabase,
'sys_log',
'event_pid',
$record->getIdentifier()
);
$foreignLog = $this->findLastPropertiesByPropertyAndTableName(
$this->foreignDatabase,
'sys_log',
'event_pid',
$record->getIdentifier()
);
$differences = ArrayUtility::compareArrays($localLog, $foreignLog, array('uid'));
$result = empty($differences);
$this->skipRecords[$record->getIdentifier()] = $result;
return $result;
} else {
return $this->skipRecords[$record->getIdentifier()];
}
}
return false;
}

/**
* @param Record $record
* @param array $columnConfiguration
Expand Down

0 comments on commit 96c5080

Please sign in to comment.