User:Aaron Schulz/deletion

From mediawiki.org

On delete, move `page` entry to `deleted_pages`

--
-- Holding area for deleted pages
--
CREATE TABLE /*$wgDBprefix*/deleted_pages (
  -- Unique identifier number. The page_id will be preserved across
  -- edits and rename operations.
  deleted_page_id int unsigned NOT NULL auto_increment,
  
  -- A page name is broken into a namespace and a title.
  -- The namespace keys are UI-language-independent constants,
  -- defined in includes/Defines.php
  deleted_page_namespace int NOT NULL,
  
  -- The rest of the title, as text.
  -- Spaces are transformed into underscores in title storage.
  deleted_page_title varchar(255) binary NOT NULL,
  
  deleted_page_suppressed bool NOT NULL,
  
  -- Timestamp of the last page deletion
  deleted_on_timestamp binary(14) NOT NULL default '',

  PRIMARY KEY deleted_page_id (deleted_page_id),
  INDEX name_title (deleted_page_namespace,deleted_page_title)
) /*$wgDBTableOptions*/;

On restore, move back to `page` and fill in other columns based on the last rev.

Some old components of Special:Undelete kept around for B/C.

Most queries that fetch revs already JOIN on page, I've fixed the remaining ones that didn't.