Feature Proposal: Empty Trash
Motivation
Currently there is no web-based interface to empty the trash web. An admin needs to remove files on the shell level. For better usability and to make TWiki more appealing to non-technical users we need a GUI to empty the trash.
Description and Documentation
- Trash-web's WebHome has an [empty trash] button
- Which leads to a WebEmptyTrash page
- This page lists all topics, each with a checkbox and topic summary
- At top and bottom are check all / clear all checkboxes
- Checkboxes are checked by default
- A few system pages starting with Web* are shown grayed out and unchecked (disabled), e.g. they can't be deleted
- Show [Delete selected topics] button at top and bottom
- Javascript popup to confirm deletion: "Do you really want to delete the selected topics? This cannot be undone." [Delete] [Cancel]
- If TrashAttachment is selected, all attachments on this topic are deleted. (For implementation, may be delete that topic and copy new one from a template topic.
Non-functional example:
Empty Trash
|
Please note that emptying the trash is permanent, it cannot be undone! |
|
All attachments deleted by users are attached to the TrashAttachment topic. If you delete that topic, all attachments will be permanently deleted. |
Implementation
The
GlobalReplacePlugin has a GUI that could be taken for reference.
Contributors: PeterThoeny - 2011-04-09
Discussion
There needs to be a way to empty the trash without logging into the server.
That method, as mentioned on
ManagingTopics, is simply too time consuming and unacceptable to many corporate environments.
For the hardcore among you:
#find . -name 'Trash' -exec find {} -name '*,v' \; | xargs rm
--
MartinCleaver - 07 Oct 2003
I attach here a quick-and-dirty script I am using with crontab to empty the Trash all nights. Add a line like the following to your crontab to clean the trash all nights at 3 AM:
0 3 * * * (cd ~twiki/bin ; ./deltrash >/dev/null 2>&1)
NOTE: You must edit the script to suit your installation
--
AndreaSterbini - 07 Oct 2003
It would be nice if the script could use something like
find Trash -mtime +28
To only delete topics that were deleted more than a month ago, but with the actual time limit configurable from a TWiki topic or TWiki.cfg. I'm not sure if you wouldn't need some extra code to handle attachments with different modified dates than their topics though.
--
SamHasler - 10 Oct 2003
Thanks for that Andreas.
For portability, it'd be best as a Perl script. Is this something you could do Sam? I'd help you get it into
CairoRelease if you did the bulk of the coding.
I'd start from the 'mailnotify' script.
--
MartinCleaver - 10 Oct 2003
I intend to bring emptytrash into
DevelopBranch - any objections?
--
MartinCleaver - 22 Nov 2004
Having just tried that sh script I've come to the conclusion that it is dangerous. I no longer intend to bring it into
DevelopBranch.
Anyone got a better script to offer as a base?
--
MartinCleaver - 14 Apr 2005
We may not want to delete the default topics (
WebPreferences etc.). It is possible to write a script that :
- backups the default topics (the MANIFEST file could be used to get their list)
- deletes the Trash web then re-creates it
- copies the backup'd topics to the newly created Trash web
--
BenVoui - 01 May 2006
Sigh. I raised this as a bug/misfeature not so long ago, not realising that this was a longstanding issue. And, as it happens, if you delete all the files from a web, it is no longer recognised as a web. So a simple rm * is a really bad idea.
--
MeredithLesly - 02 May 2006
I see that some are wishing to empty the TWiki Trash like the trash from their Mailbox. But isn't it a very important aspect of the Wiki philosophy to have history available?
I mean, we might not only want to know the history of a still available topic but also of what's been written an discarded before. If you empty the Trash Web you are devalidating your TWiki history in fact.
That being said, of course anybody is free to do it the way it suits him best. There could be support maybe in the tools folder to empty the trash but as people often rather tend to delete then to think it shouldn't be a too obvious feature.
And anyway. I thought a Wiki was something to add content to and not to delete it from.
--
ManfredMislik - 31 Jan 2007
I basically agree; a wiki at the workplace is the corporate memory. Content gets obsolete over time, so a good way to
ManageStaleContent is needed.
Disk space is cheap, a large Trash web is not that much of an issue. Once a year one could move the content of the Trash web to a sub-web, such as Trash.Trash2005, Trash.Trash2006, Trash.Trash2007, etc.
--
PeterThoeny - 01 Feb 2007
Not everyone uses cheap disk space Peter...
It appears that you have no interest in making trash removal accessible to the users. They can create, edit, move, do almost anything with the content but we can't trust anyone to empty the trash?
--
JohnWright - 20 Feb 2007
No update to this in 3+ years?!? This is still a major problem for reasons beyond the question of "stale" data. In my case, I tried using the
AnyWikiDraw plugin to create a drawing attachment. It didn't work right and the issue seemed to be the attachment. A couple iterations of trying the plugin, then deleting the attachment to start fresh ran into the issue that I couldn't do the second delete (the file already existed in
TrashAttachment). There appears to be no well-defined method of cleaning up the Trash to ensure that everything keeps working.
--
DavidMasterson - 2010-04-26
Removing duplicate attachments is tracked in
TWikibug:Item5384 - we are still looking for a contributor to code a fix.
--
PeterThoeny - 2010-04-26
Resurrecting this from
ParkedProposal to
UnderInvestigation.
Useful feature. Spec of web-based interface needs TBD, for example showing a table with all attachments with a checkbox each, checked by default.
Anyone interested in defining spec and implementing this?
--
PeterThoeny - 2010-07-29
It'd be a hack, but... it'd be easy to run something to delete all topics NOT starting with "Web" in the Trash web. ..dunno if I'd call that a "spec" but I'd be happy to help implement it.
--
PaulReiber - 2011-02-14
I added the spec at the top of this topic.
--
PeterThoeny - 2011-03-15
This came up again in
Support.HowToEmptyTrash.
--
PeterThoeny - 2011-11-27
For TWiki administrators, I believe this feature should be absolutely essential and I'm willing to work on this, time permitting.
Given this feature proposal, and Peter Thoeny's guidance to establish it as a plugin, I will be working to that end, to be supported on TWiki-5.1.0 and tested on Debian Linux 6.0.3 (Squeeze) with Perl v5.10.1.
Initial implementation will support deleting trashed attachments, with subsequent version(s) to support deleting trashed topics which is more complicated.
Probably the biggest security concern is that this will remove files directly from the file system, which is probably why so many people decided not to implement this.
To safeguard the file system, probably the easiest thing to do is to hard-code the location of trash attachments so it can only remove files from there, e.g.:
<twiki_root>/pub/Trash/TrashAttachment/
I will be reviewing
ReadmeFirst to get started and will provide an initial implementation for review. Any pointers are appreciated. Thanks.
--
SergeiHaramundanis - 2011-11-27
How about rotating Trash instead of emptying?
Let's say we keep 5 Trash's. Then, we create a new empty Trash (probably from a _trash) after renaming Trash to Trash1 after renaming Trash1 to Trash2 after renaming Trash2 to Trash3 ... after deleting Trash5.
It would be done periodically (once a day or week) by a cron job.
--
HideyoImazu - 2011-12-02
Rotation could be done but I am concerned about increasing the complexity. For example, an extra step is needed to install a cron job, and extra docs and links are needed to access the rotated trash webs.
--
PeterThoeny - 2011-12-02
The concept of trash rotation seems to me contrary to the requested functionality:
1. allow easy, intuitive, permanent removal of artifacts from the repository 2. provide access to this functionality directly from the UI without external dependencies
This is the scope of the initial version, which can be extended in the future where it makes sense.
--
SergeiHaramundanis - 2011-12-03
I put the this feature request into "parked proposal" state and removed my name to signal another more committed developer to take the lead. I don't want to be a roadblock.
--
GeorgeTrubisky - 2011-12-06
Thank you Sergei for committing to implement this feature!
--
PeterThoeny - 2011-12-07