Loading...
 
Skip to main content

History: WikiPageRenameDev

Preview of version: 1

This feature is an enhancement to the wiki rename feature.

  • automatically set up an alias to old wikipage
  • option is off by default 😊
  • outside links to wikipage don't get a 404


Suggested fix

  • create a new database table (page_aliases) to hold the old and new page names
  • if index.php finds page doesn't exist, search the the "old" column of the table for a match to the supplied page name
  • generate an "HTTP/1.1 301 Moved Permenantly" response, giving the new location (obtained from the "new" field of that database entry) to the web client. (see w3.org STD1Question for error 301 implementation details)


rename algorithm (pseudocode)

Copy to clipboard
if (the new_name already exists as a valid page) { promptForAlternativeName return } // if there used to be a page with this name if (the new_name exists in the "old" column of the table) { // if we are moving the page back to an older location if (the "new" field for that row matches the existing_name) { database.pageAliasesTable.deleteTheRow // this catches files that have been renamed more than once searchAndReplaceAllInstancesOf( existing_name with \\ new_name in the "new" column) renameThePage database.pageAliasesTable.addARow(old="old_name", \\ new="new_name") return } else { promptForAlternativeName return } // this catches files that have been renamed more than once searchAndReplaceAllInstancesOf( existing_name with \\ new_name in the "new column" ) renameThePage database.pageAlaisesTable.addARow(old="old_name", \\ new="new_name") // end



The create/editpage and deletepage features would also need changing to check if the page used to exist and either prompt for an alternative name or update the (proposed) pageAliasesTable table.

A nice additional touch would be to add a row to the database with "new" set to null whenever a page is deleted permanently (perhaps add a "permanent" checkbox to the delete page). Then index.php could generate an "HTTP/1.1 410 Gone" error rather than 404. This causes smart clients to delete bookmarks to the page and smart external wikis to mark the link as invalid.

See also: WikiDev#Renaming Wiki PagesQuestion

History

Information Version
Michael Davey 4
View
Michael Davey added para about tiki pings/trackbacks 3
View
Michael Davey 2
View
Michael Davey 1
View