Skip to content

Conversation

@malberts
Copy link
Contributor

@malberts malberts commented Nov 13, 2024

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:

Note that because of MediaWiki supporting partial undeletion and history split/merge, there is no guarantee ar_page_id matches the page ID it's going to be undeleted to.

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.

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 );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants