diff --git a/Classes/Domain/Index/TcaIndexer/TcaTableService.php b/Classes/Domain/Index/TcaIndexer/TcaTableService.php
index dd3df5f..70bb52d 100644
--- a/Classes/Domain/Index/TcaIndexer/TcaTableService.php
+++ b/Classes/Domain/Index/TcaIndexer/TcaTableService.php
@@ -258,18 +258,27 @@ class TcaTableService
* Checks whether the given record was blacklisted by root line.
* This can be configured by typoscript as whole root lines can be black listed.
*
+ * Also further TYPO3 mechanics are taken into account. Does a valid root
+ * line exist, is page inside a recycler, is inherited start- endtime
+ * excluded, etc.
+ *
* @param array &$record
* @return bool
*/
protected function isRecordBlacklistedByRootline(array &$record)
{
- // If no rootline exists, the record is on a unreachable page and therefore blacklisted.
- if ($record['pid'] == 0) {
- return false;
+ $pageUid = $record['pid'];
+ if ($this->tableName === 'pages') {
+ $pageUid = $record['uid'];
}
- $rootline = $this->objectManager->get(RootlineUtility::class, $record['pid'])->get();
- if (!isset($rootline[0])) {
+ try {
+ $rootline = $this->objectManager->get(RootlineUtility::class, $pageUid)->get();
+ } catch (\RuntimeException $e) {
+ $this->logger->notice(
+ sprintf('Could not fetch rootline for page %u, because: %s', $pageUid, $e->getMessage()),
+ [$record, $e]
+ );
return true;
}
@@ -278,12 +287,29 @@ class TcaTableService
if ($this->isBlackListedRootLineConfigured()
&& in_array($pageInRootLine['uid'], $this->getBlackListedRootLine())
) {
+ $this->logger->info(
+ sprintf(
+ 'Record %u is black listed due to configured root line configuration of page %u.',
+ $record['uid'],
+ $pageInRootLine['uid']
+ ),
+ [$record, $pageInRootLine]
+ );
return true;
}
+
if ($pageInRootLine['extendToSubpages'] && (
($pageInRootLine['endtime'] > 0 && $pageInRootLine['endtime'] <= time())
|| ($pageInRootLine['starttime'] > 0 && $pageInRootLine['starttime'] >= time())
)) {
+ $this->logger->info(
+ sprintf(
+ 'Record %u is black listed due to configured timing of parent page %u.',
+ $record['uid'],
+ $pageInRootLine['uid']
+ ),
+ [$record, $pageInRootLine]
+ );
return true;
}
}
diff --git a/Tests/Functional/Fixtures/Indexing/PagesIndexer/BrokenRootLine.xml b/Tests/Functional/Fixtures/Indexing/PagesIndexer/BrokenRootLine.xml
new file mode 100644
index 0000000..81f2316
--- /dev/null
+++ b/Tests/Functional/Fixtures/Indexing/PagesIndexer/BrokenRootLine.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ 3
+ 2
+ Some disabled page due broken root line
+
+
+ 4
+ 3
+ Some disabled page due to parent pages root line being broken
+
+
+
+ 6
+ 1
+ Some enabled page due valid root line
+
+
diff --git a/Tests/Functional/Fixtures/Indexing/PagesIndexer/Recycler.xml b/Tests/Functional/Fixtures/Indexing/PagesIndexer/Recycler.xml
new file mode 100644
index 0000000..1421ad5
--- /dev/null
+++ b/Tests/Functional/Fixtures/Indexing/PagesIndexer/Recycler.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ 2
+ 1
+ Some disabled page due being recycler
+ 255
+
+
+ 3
+ 2
+ Some disabled page due to parent page being recycler
+
+
+
+ 6
+ 1
+ Some enabled page due to no be below recycler
+
+
diff --git a/Tests/Functional/Indexing/PagesIndexerTest.php b/Tests/Functional/Indexing/PagesIndexerTest.php
index 2f00d2f..244413d 100644
--- a/Tests/Functional/Indexing/PagesIndexerTest.php
+++ b/Tests/Functional/Indexing/PagesIndexerTest.php
@@ -64,10 +64,12 @@ class PagesIndexerTest extends AbstractFunctionalTestCase
/**
* @test
+ * @dataProvider rootLineDataSets
+ * @param string $dataSetPath
*/
- public function inheritedTimingIsRespectedDuringIndexing()
+ public function rootLineIsRespectedDuringIndexing($dataSetPath)
{
- $this->importDataSet('Tests/Functional/Fixtures/Indexing/PagesIndexer/InheritedTiming.xml');
+ $this->importDataSet($dataSetPath);
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class);
$tableName = 'pages';
@@ -90,4 +92,13 @@ class PagesIndexerTest extends AbstractFunctionalTestCase
$this->inject($indexer, 'connection', $connection);
$indexer->indexAllDocuments();
}
+
+ public function rootLineDataSets()
+ {
+ return [
+ 'Broken root line' => ['Tests/Functional/Fixtures/Indexing/PagesIndexer/BrokenRootLine.xml'],
+ 'Recycler doktype' => ['Tests/Functional/Fixtures/Indexing/PagesIndexer/Recycler.xml'],
+ 'Extended timing to sub pages' => ['Tests/Functional/Fixtures/Indexing/PagesIndexer/InheritedTiming.xml'],
+ ];
+ }
}