@@ -180,19 +180,28 @@ protected function aggregate(ArchiveProcessor $archiveProcessor): array
180180 [$ this , 'flatRowToTitleHierarchyPath ' ],
181181 $ archiveProcessor
182182 );
183- $ this ->removeFlatPathMetadataFromDataTable ($ tablesByType [Action::TYPE_PAGE_URL ]);
184- $ this ->removeFlatPathMetadataFromDataTable ($ tablesByType [Action::TYPE_PAGE_TITLE ]);
185-
186- $ prefix = $ archiveProcessor ->getParams ()->getSite ()->getMainUrl ();
187- $ prefix = rtrim ($ prefix , '/ ' ) . '/ ' ;
188- ArchivingHelper::setFolderPathMetadata ($ tablesByType [Action::TYPE_PAGE_URL ], $ isUrl = true , $ prefix );
189-
190- ArchivingHelper::setFolderPathMetadata ($ tablesByType [Action::TYPE_PAGE_TITLE ], $ isUrl = false );
183+ $ this ->finalizeBuiltFromFlatHierarchyTable (
184+ $ archiveProcessor ,
185+ $ tablesByType [Action::TYPE_PAGE_URL ],
186+ Archiver::PAGE_URLS_RECORD_NAME
187+ );
188+ $ this ->finalizeBuiltFromFlatHierarchyTable (
189+ $ archiveProcessor ,
190+ $ tablesByType [Action::TYPE_PAGE_TITLE ],
191+ Archiver::PAGE_TITLES_RECORD_NAME
192+ );
191193
192194 $ dataTable = $ tablesByType [Action::TYPE_SITE_SEARCH ];
193195 $ this ->deleteUnusedColumnsFromKeywordsDataTable ($ dataTable );
194196
195- foreach ($ tablesByType as $ dataTable ) {
197+ foreach ($ tablesByType as $ actionType => $ dataTable ) {
198+ if (
199+ $ actionType === Action::TYPE_PAGE_URL
200+ || $ actionType === Action::TYPE_PAGE_TITLE
201+ ) {
202+ continue ;
203+ }
204+
196205 ArchivingHelper::deleteInvalidSummedColumnsFromDataTable ($ dataTable );
197206 }
198207 foreach ($ flatPageTablesByType as $ flatDataTable ) {
@@ -257,17 +266,7 @@ protected function beforeInsertBuiltFromFlatHierarchyRecord(
257266 return ;
258267 }
259268
260- $ hierarchicalTable ->setMetadata (DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME , Metrics::getColumnsAggregationOperation ());
261- if ($ recordName === Archiver::PAGE_URLS_RECORD_NAME ) {
262- $ prefix = $ archiveProcessor ->getParams ()->getSite ()->getMainUrl ();
263- $ prefix = rtrim ($ prefix , '/ ' ) . '/ ' ;
264- ArchivingHelper::setFolderPathMetadata ($ hierarchicalTable , $ isUrl = true , $ prefix );
265- } else {
266- ArchivingHelper::setFolderPathMetadata ($ hierarchicalTable , $ isUrl = false );
267- }
268-
269- $ this ->removeFlatPathMetadataFromDataTable ($ hierarchicalTable );
270- ArchivingHelper::deleteInvalidSummedColumnsFromDataTable ($ hierarchicalTable );
269+ $ this ->finalizeBuiltFromFlatHierarchyTable ($ archiveProcessor , $ hierarchicalTable , $ recordName );
271270 }
272271
273272 private function flatRowToHierarchyPath (Row $ flatRow , int $ actionType ): ?array
@@ -307,6 +306,25 @@ private function removeFlatPathMetadataFromDataTable(DataTable $dataTable): void
307306 }
308307 }
309308
309+ private function finalizeBuiltFromFlatHierarchyTable (
310+ ArchiveProcessor $ archiveProcessor ,
311+ DataTable $ hierarchicalTable ,
312+ string $ recordName
313+ ): void {
314+ $ hierarchicalTable ->setMetadata (DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME , Metrics::getColumnsAggregationOperation ());
315+
316+ if ($ recordName === Archiver::PAGE_URLS_RECORD_NAME ) {
317+ $ prefix = $ archiveProcessor ->getParams ()->getSite ()->getMainUrl ();
318+ $ prefix = rtrim ($ prefix , '/ ' ) . '/ ' ;
319+ ArchivingHelper::setFolderPathMetadata ($ hierarchicalTable , $ isUrl = true , $ prefix );
320+ } elseif ($ recordName === Archiver::PAGE_TITLES_RECORD_NAME ) {
321+ ArchivingHelper::setFolderPathMetadata ($ hierarchicalTable , $ isUrl = false );
322+ }
323+
324+ $ this ->removeFlatPathMetadataFromDataTable ($ hierarchicalTable );
325+ ArchivingHelper::deleteInvalidSummedColumnsFromDataTable ($ hierarchicalTable );
326+ }
327+
310328 private function appendLegacyHierarchyRowsToFlatTable (DataTable $ sourceTable , array $ path , DataTable $ flatTable , int $ actionType ): void
311329 {
312330 foreach ($ sourceTable ->getRowsWithoutSummaryRow () as $ row ) {
0 commit comments