Motivation
It is now possible to rollback a version of a topic under the
more topic actions . The same feature would be very useful for attachments.
Description and Documentation
A user uploads a new version of an image and then realises that its not the good version. The rollback feature would allow the user to revert to a previous version
Examples
The attachment table found at the bottom of each TWiki topic has a
manage option for each attachment. Clicking on this
manage button brings up the following interface.
- TWiki attachment manage options:
TWikiAttachmentManage.jpg
The above lists all the versions of a particular attachment, in this case
like_image_map.gif
The new feature should allow the user to restore a previous version as seen in 'more topic actions' as seen below
In the
Action column the actions could be
view, restore
Impact
Implementation
We can checkout a specfic version of a file with
co -rx.x topicname and then force a new version, Or checkout a copy of a version then use the TWik's
attach feature.
--
Contributors: PeterJones - 2010年02月15日
Discussion
Useful feature. Could you please add some docs and the user interaction: What add to what screen, what new screen, how a user selects and restores a previous attachment version.
--
PeterThoeny - 2010年02月15日
Ping! This is a useful feature. If not Peter Jones, anyone taking this?
Spec needs to be fleshed out first.
--
PeterThoeny - 2010年10月02日
Spec is not clear. My two cents:
- Make it easy and intuitive (point and click)
- Make it safe to avoid unintended rollback
Possible UI flow:
- The table that lists revisions has an Action column. Add a
restore link as noted above, "the actions could be view, restore ."
- The
restore link leads to a rollback confirm screen that has title restore attachment version, an input field pre-filled with version of previous screen and a [Restore] button.
--
PeterThoeny - 2011年01月17日
Ok, having thought about it further it would be safer for the user to first
checkout an old version that he/she wants to restore in order to check it. This would avoid unintended rollbacks. I attach changes made to 2 files:
-
attachtables.tmpl this adds the option to checkout a previous version
-
view.pm this changes the viewfile static method. If an extra parameter co is added to the URL then the file is saved locally. Otherwise viewfile runs as before
--
PeterJones - 2011年05月02日
Here is a better implementation. The files
Upload.pm and
attachtables.tmpl are attached to this topic.
- The
rollback option listed next to view in manage attachment.
- The user is requested to confirm the rollback.
- The previous version is then read and stored as a new version using
$session->{store}->readAttachment and $session->{store}->saveAttachment
--
PeterJones - 2011年07月18日
This is long overdue & I support the effort, but have several concerns.
- There is still the open problem that reverting or even viewing an older topic revision does not use the corresponding versions of attachments.
Please consider your implementation of attachment rollback carefully and ensure that you don't make linking topic revs to attachment revisions harder to solve. At a minimum, I think this requires capturing the topic revision when an attachment is rolled-back.
- Rolling-back an attachment needs to be logged and attributable to the user who did it. I don't see that happening in the code (but haven't tried it.)
- Again code reading - I see where you get the old version and write it to working/tmp. I don't see where the /tmp file is removed. And I also worry about name conflicts. And you are blindly untainting whatever filename you get - you're in trouble if a user includes '../' and gets you to do something unfortunate. Why aren't you using File::Temp->new for this? It's easier & safer...
I haven't done a complete review, but these jumped out at me.
Don't let the issues discourage you - this is fundamentally a good idea.
--
TimotheLitt - 2011年07月27日
Thank you Pete for posting this code!
At the
IstanbulReleaseMeeting2011x08x01 we decided to postpone this feature after TWiki-5.1.0 release.
- code posted after code freeze
- code is based on TWiki-4.3, not on trunk
- more work involved in porting and testing on trunk because feature is not posted as a diff
- Timothe has some questions
--
PeterThoeny - 2011年08月01日
My biggest concern is someone accidentally or intentionally destroying information.
In subversion, you can always retrieve old, renamed, and deleted versions. You can even recover an older version of a "deleted" file and put it back into the current revision.
I don't think that's possible with
RCS, the current revision-control system being used.
--
SteveKelem - 2012年02月09日
I changed the status to
ParkedProposal due to long inactivity. Anybody feel free to claim and implement this useful feature.
--
Peter Thoeny - 2015年06月18日