SID-01209: How to copy a topic with history
| Status: |
Answered |
TWiki version: |
5.0.0 |
Perl version: |
|
| Category: |
CategoryEditing |
Server OS: |
|
Last update: |
14 years ago |
Hello
I work with the twiki 5.0.0. I wish to perform a copy of a topic with a different name. In addition, all versions of the topic copied shall be copied too. I have already read this thread about topic copies :
HowToCopyATopic
I used the twiki edit scripts to perform the copy. But this script only performs a copy of the last revision of the orignal topic. How to perfom a copy of topic with their revisions ?
Thanks in advance
--
ChenalBenoit - 2011-06-22
Discussion and Answer
The
templatetopic option to the
edit and
save script does not carry over the topic history. I was going to say that you need to write a plugin that uses the API to copy a topic with its history, but there is no
TWikiFuncDotPm API call to do that. As a workaround you can create a small cgi script that copies files. Example shell commands:
cd /path/to/twiki
cp -p data/Myweb/OriginalTopic.txt data/Myweb/NewTopic.txt
cp -p data/Myweb/OriginalTopic.txt,v data/Myweb/NewTopic.txt,v
cp -pr pub/Myweb/OriginalTopic pub/Myweb/NewTopic
It is probably wise to check if the new topic exists, and return an error if it does.
--
PeterThoeny - 2011-06-22
Ok thanks I'll try .... Just another question and after that I will close the topic. I will copy the topic attachements. Can I do that by using this method too ?
--
ChenalBenoit - 2011-06-27
I updated above example to include also the attached files.
--
PeterThoeny - 2011-06-27
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.