Conversation
malberts
commented
Nov 13, 2024
Comment on lines
+61
to
+69
| // TODO: untested | ||
| $repo = PersistentPageIdentifiersExtension::getInstance()->getPersistentPageIdentifiersRepo(); | ||
| $oldPersistentId = $repo->getPersistentId( $restoredRevision->getPageId() ); | ||
|
|
||
| if ( $oldPersistentId === null ) { | ||
| return; | ||
| } | ||
|
|
||
| $repo->savePersistentId( $restoredRevision->getPageId(), $oldPersistentId ); |
Contributor
Author
There was a problem hiding this comment.
This code is incomplete anyway, since we'll need to remove the old row in persistent_page_ids table due to the UNIQUE constraint.
Otherwise, we can drop the constraint, but then we end up with different page_ids mapping to the same persistent_id. This seems fundamentally wrong:
- there should be only one page with a specific persistent ID
- if deleted page_id=1 has persistent_id=FOO, and an undelete leads to it becoming page_id=2 with peristent_id=FOO, would it still be possible to undelete page_id=1 again?
But the above is dependent on figuring out when a page ID is missing in the first place.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #10
Normal page deletions already keep their page ID, and therefore persistent ID
Screencast_20241113_215449.webm
Marked as draft because I have not figured out how to reproduce a real scenario where the original page ID is missing after deletion.
The docs mention:
My attempt at partial undeletion (picking only some revisions) still results in the same page ID.
History split/merge sounds like something that might have other complications when it comes to deciding which persistent ID to keep. However, when merging page A revisions into Page B using
Special:MergeHistory, it just adds the revisions to Page B, and Page B keeps its persistent Id.