-
-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Ensure recursive page update on page movement
If a page is moved, subpages have to be considered, e.g. as rootline and slug might have changed. Also the MountPagesUpdater has to be triggered to ensure mounted pages will be updated too. This commit adds the missing recursive updates, an extension to the RecordMovedEvent and PageMovedEvent is done allowing that recursive updates on move operations will only be done if the parent page of the page has changed. Resolves: #206
- Loading branch information
1 parent
a4013bd
commit 9ec7308
Showing
14 changed files
with
288 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Classes/Domain/Index/Queue/UpdateHandler/Events/AbstractRecordMovedEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\Events; | ||
|
||
/** | ||
* Abstract event base for events fired if a record or page is moved | ||
*/ | ||
abstract class AbstractRecordMovedEvent extends AbstractDataUpdateEvent | ||
{ | ||
/** | ||
* pid of the record prior moving | ||
* | ||
* @var int|null | ||
*/ | ||
protected ?int $previousParentId = null; | ||
|
||
/** | ||
* Sets the record's pid prior moving | ||
* | ||
* @param int $pid | ||
*/ | ||
public function setPreviousParentId(int $pid) | ||
{ | ||
$this->previousParentId = $pid; | ||
} | ||
|
||
/** | ||
* Returns the record's pid prior moving | ||
* | ||
* @return int|null | ||
*/ | ||
public function getPreviousParentId(): ?int | ||
{ | ||
return $this->previousParentId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
Tests/Integration/Fixtures/can_collect_garbage_if_page_tree_is_moved.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"pages", | ||
,"uid","pid","is_siteroot","doktype","sys_language_uid","l10n_parent","slug","title","sorting","no_search_sub_entries" | ||
,2,1,0,1,0,0,"/1st-subpage-in-root-1","1st subpage in root 1",10,0 | ||
,3,1,0,1,0,0,"/2nd-subpage-in-root 1","2nd subpage in root 1",20,0 | ||
,4,1,0,254,"sys_language_uid","l10n_parent","/sysfolder-with-set-option-no_search_sub_entries","sysfolder with set option no_search_sub_entries",99,1 | ||
,10,1,0,1,0,0,"/root-of-subtree-to-be-moved","root of subtree to be moved",30,0 | ||
,11,10,0,1,0,0,"/root-of-subtree-to-be-moved/first-child-of-subtree-to-be-moved","first child of subtree to be moved",10,0 | ||
,12,10,0,1,0,0,"/root-of-subtree-to-be-moved/2nd-child-of-subtree-to-be-moved","2nd child of subtree to be moved",20,0 | ||
,13,11,0,1,0,0,"/root-of-subtree-to-be-moved/first-child-of-subtree-to-be-moved/3rd-child-of-subtree-to-be-moved","3rd child of subtree to be moved",10,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
Tests/Integration/IndexQueue/Fixtures/can_handle_mounted_page_tree_movement.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"pages", | ||
,"uid","pid","is_siteroot","doktype","sys_language_uid","l10n_parent","slug","title","sorting","no_search_sub_entries","mount_pid_ol","mount_pid" | ||
,2,1,0,1,0,0,"/1st-subpage-in-root-1","1st subpage in root 1",10,0,0,0 | ||
,3,1,0,7,0,0,"/mount-point-for-subtree","mount point for subtree",20,0,0,10 | ||
,4,1,0,254,"sys_language_uid","l10n_parent","/sysfolder-with-set-option-no_search_sub_entries","sysfolder with set option no_search_sub_entries",99,1,0,0 | ||
,10,1,0,1,0,0,"/root-of-subtree-to-be-moved","root of subtree to be moved",30,0,0,0 | ||
,11,10,0,1,0,0,"/root-of-subtree-to-be-moved/first-child-of-subtree-to-be-moved","first child of subtree to be moved",10,0,0,0 |
9 changes: 9 additions & 0 deletions
9
Tests/Integration/IndexQueue/Fixtures/can_handle_page_tree_movement.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"pages", | ||
,"uid","pid","is_siteroot","doktype","sys_language_uid","l10n_parent","slug","title","sorting","no_search_sub_entries" | ||
,2,1,0,1,0,0,"/1st-subpage-in-root-1","1st subpage in root 1",10,0 | ||
,3,1,0,1,0,0,"/2nd-subpage-in-root 1","2nd subpage in root 1",20,0 | ||
,4,1,0,254,"sys_language_uid","l10n_parent","/sysfolder-with-set-option-no_search_sub_entries","sysfolder with set option no_search_sub_entries",99,1 | ||
,10,1,0,1,0,0,"/root-of-subtree-to-be-moved","root of subtree to be moved",30,0 | ||
,11,10,0,1,0,0,"/root-of-subtree-to-be-moved/first-child-of-subtree-to-be-moved","first child of subtree to be moved",10,0 | ||
,12,10,0,1,0,0,"/root-of-subtree-to-be-moved/2nd-child-of-subtree-to-be-moved","2nd child of subtree to be moved",20,0 | ||
,13,11,0,1,0,0,"/root-of-subtree-to-be-moved/first-child-of-subtree-to-be-moved/3rd-child-of-subtree-to-be-moved","3rd child of subtree to be moved",10,0 |
Oops, something went wrong.