Edgewall Software

Version 7 (modified by Christian Boos, 14 years ago) ( diff )

added link to MediaWiki's equivalent operation

Wiki Rename

There's now a development branch for adding a page rename operation to the TracWiki, in sandbox/wiki-rename.

Among the various possibilities for performing a rename, this implementation aims at simplicity. The page name is modified "in-place", i.e. the object identity is mutated and as such, the whole history is kept and becomes associated to the renamed wiki page.

  • Status: initial version, should work reasonably well.
  • View the changes: log:sandbox/wiki-rename
  • Test the branch, e.g.:
    % svn co http://svn.edgewall.org/repos/trac/sandbox/wiki-rename
    % cd wiki-rename
    % python setup.py develop
    % python trac/web/standalone.py -p 8000 <your-test-environment>
    

You need to be a WIKI_ADMIN in order to be able to rename a page (or at the very least, have the new WIKI_RENAME permission).

How it works

Example: renaming WikiStart to ProjectHome

  • before the rename:
pagename text comment
WikiStart version1 comment1
WikiStart version2 comment2
WikiStart version3 comment3
  • after the rename:
pagename text comment
ProjectHome version1 comment1
ProjectHome version2 comment2
ProjectHome version3 comment3

the WikiStart page will be (optionally) recreated with a redirection to the new page:

pagename text comment
WikiStart See ProjectHome Renamed WikiStart to ProjectHome

Note that this is very similar to how moving a page in MediaWiki works.

Overview of the changes

  • added new WikiPage.rename and Attachment.reparent_all methods
  • added new wiki_rename.html template and the corresponding handler methods, WikiModule._render_confirm_rename and WikiModule._do_rename methods

Discussion

Feel free to provide feedback.

  • Would be nice to have a HTTP 301 redirect from the old wiki page to the new one, to keep searchengine rankings etc.
    • Right, real redirect is on the TODO list (#976)
  • Another TODO optionally rename sub-pages as well, and more generally, have the possibility to do batch renames
  • Another TODO would be nice to have an entry in the history of the page including the name, date and optional comment of the rename event.
  • Another TODO also rename all links to renamed pages on all other pages and create for this a new version for all affected pages

Cabbiepete: This sounds like an excellent idea currently re-organising the wiki structure is quite painful.


See also: #1106, TracDev/Proposals/AdvancedWikiOperations

Note: See TracWiki for help on using the wiki.