Requests for comment/Page deletion

This page serves as ground for discussion on the best way to integrate RevDelete with normal page deletion. Wikitech thread:

Particularly, moving page deletion to a RevDelete mechanism would solve:
 * 21279 RevDelete + Normal deletion break log links.
 * 18104 Deleted revisions should be identified by id, not timestamp.
 * Easy comparison between deleted revisions and existing ones.
 * It is really expensive to delete pages with lots of revisions.
 * Page protection can be kept on delete + undelete cycles.
 * Groups of revisions that are deleted are merged with all other deleted revisions for that page making them indistinguishable from each other.
 * page_id changes when a page is deleted and then restored.

archived_page table
Use a table similar to page which holds page content when it is deleted.

Deleting a page is moving the page entry to a new entry in the archived_page table.

We could have different deleted pages: groups of revisions which once existed at the same history. So revisions are no longer mixed. Each deleted page has a different page_id (although they share namespace and title). In such case, page creation produces a new page_id.

Otherwise, page creation recovers the entry from archived_page.


 * PRO: page JOIN already done in core. Also, most places want to join to get the page for other reasons anyway, so this has some "secure by default" nature to it. Aaron 20:23, 27 October 2011 (UTC)

page_deleted field
Add a page_deleted field to the table page.

The page is marked on the page_deleted bitfield as no longer existing. Another option would be to define that page doesn't exist if it has no visible [latest] edit (page_latest=0?).

Page creation reuses the same page entry if it exists.


 * CON: We will need to add "rev_page = page_id AND page_deleted = 0" checks in revision queries.
 * CON: What happens to the old page entry? Moved to another table? Aaron 20:23, 27 October 2011 (UTC)

55398 &mdash; Move page deletion to a RevDelete mechanism; kill archive table (fire optional)

Delete revisions on page deletion?
With either approach, we could mark as deleted all revisions or rely on the page change to not allow them to be accessed. The later favours fast deletion and undeletion. The first aims for consistency. However, deleting one revision, then deleting the full page and undeleting should have kept that revision gone...
 * This would be a bad idea: if some revisions of the page were deleted (e.g. for legal reasons), these would get inadvertently get restored when deleting and restoring the page. If we leave the revisions as they were, deleting and restoring the page will keep the deleted revisions intact. Duesentrieb ⇌ 08:36, 8 August 2013 (UTC)
 * I disagree; we could add another field, rv_logid, for the log_id of the deletion event. Then upon restoring the page, only the revisions pertaining to the pertinent deletion event would be restored. So, suppose you revision delete (log_id 1). Then you delete the whole page (log_id 2). Then you undelete the page. You only restore the revisions that have rv_logid 2, and leave the rv_logid 1 revisions deleted. Leucosticte (talk) 05:23, 7 October 2013 (UTC)