| 1 | = Wiki Rename = |
| 2 | |
| 3 | There's now a development branch for adding a page rename operation to the TracWiki, in [source:/sandbox/wiki-rename]. |
| 4 | |
| 5 | 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. |
| 6 | |
| 7 | - Status: initial version, should work reasonably well. |
| 8 | - View the changes: log:sandbox/wiki-rename |
| 9 | - Test the branch, e.g.: |
| 10 | {{{ |
| 11 | % svn co http://svn.edgewall.org/repos/trac/sandbox/wiki-rename |
| 12 | % cd wiki-rename |
| 13 | % python setup.py develop |
| 14 | % python trac/web/standalone.py -p 8000 <your-test-environment> |
| 15 | }}} |
| 16 | |
| 17 | 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). |
| 18 | |
| 19 | == How it works == |
| 20 | |
| 21 | '''Example:''' renaming !WikiStart to !ProjectHome |
| 22 | |
| 23 | - before the rename: |
| 24 | |
| 25 | || ''pagename'' || ''text'' || ''comment'' || |
| 26 | || !WikiStart || version1 || comment1 || |
| 27 | || !WikiStart || version2 || comment2 || |
| 28 | || !WikiStart || version3 || comment3 || |
| 29 | |
| 30 | - after the rename: |
| 31 | |
| 32 | || ''pagename'' || ''text'' || ''comment'' || |
| 33 | || !ProjectHome || version1 || comment1 || |
| 34 | || !ProjectHome || version2 || comment2 || |
| 35 | || !ProjectHome || version3 || comment3 || |
| 36 | |
| 37 | the !WikiStart page will be (optionally) recreated with a redirection to the new page: |
| 38 | |
| 39 | || ''pagename'' || ''text'' || ''comment'' || |
| 40 | || !WikiStart || See !ProjectHome ||Renamed !WikiStart to !ProjectHome || |
| 41 | |
| 42 | == Overview of the changes == |
| 43 | |
| 44 | - added new `WikiPage.rename` and `Attachment.reparent_all` methods |
| 45 | - added new `wiki_rename.html` template and the corresponding handler methods, `WikiModule._render_confirm_rename` and `WikiModule._do_rename` methods |
| 46 | |
| 47 | == Discussion == |
| 48 | |
| 49 | Feel free to provide feedback. |
| 50 | |
| 51 | ---- |
| 52 | See also: #1106, TracDev/Proposals/AdvancedWikiOperations |