[wikka-community] Tracking attachement changes

Braun, Thomas Thomas.Braun
Tue Jan 5 09:31:40 GMT 2010


Hi there,

we have a non-public wikkawiki in our research group, where I'm the one responsible for it.
Recently we had some cases where attachements have been deleted accicentally (all users are allowed to do that in our wiki).

So I added some magic to write file changes to the revision log. See the two inline diffs.
What do you think? Or do I screw here something seriously up?
In the long run the revision log might get a bit cluttered but this should be no problem.

Thanks,
Thomas

--- files.xml.php	Mon Jan 26 22:34:52 2009
+++ files.xml.php.new	Tue Jan  5 10:23:14 2010
@@ -50,6 +50,8 @@
             // if ($this->HasAccess('write')) {
 		if ($this->IsAdmin()) {
 				@unlink($upload_path.DIRECTORY_SEPARATOR.$_GET['file']); #89, #312 // TODO if this is admin-only, why hide any errors?
+    		        $note="Deleted file " . basename($_GET['file']);
+  	    		$this->SavePage($this->tag,$this->page['body'],$note);
             }
             print $this->redirect($this->Href());
 }
--- files.php	Sun Aug 30 21:26:22 2009
+++ files.php.new	Tue Jan  5 10:11:09 2010
@@ -197,6 +197,10 @@
 								{
 									echo(ERROR_DURING_FILE_UPLOAD . "<br />\n");
 								}
+								else{
+									$note="Added file " . $destfile;
+								        $this->SavePage($this->tag,$this->page['body'],$note);
+								}
 							}
 							else
 							{
-- 
PhD student

Thomas Braun
c/o EMPA, nanotech at surfaces
Feuerwerkerstrasse 39
3602 Thun
Switzerland

Tel.: +41/ (0)33 228 2237





More information about the community mailing list