gforge-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gforge-commits] gforge/common/tracker Artifact.class,1.24,1.25


From: tperdue
Subject: [Gforge-commits] gforge/common/tracker Artifact.class,1.24,1.25
Date: Mon, 06 Dec 2004 18:51:23 -0600

Update of /cvsroot/gforge/gforge/common/tracker
In directory db.perdue.net:/home/tperdue/share/dev.gforge.org/common/tracker

Modified Files:
        Artifact.class 
Log Message:
adding delete() function to Artifact.class

Index: Artifact.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/tracker/Artifact.class,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- Artifact.class      27 Oct 2004 21:57:50 -0000      1.24
+++ Artifact.class      7 Dec 2004 00:51:21 -0000       1.25
@@ -510,6 +510,52 @@
        }
 
        /**
+        *  delete - delete this tracker and all its related data.
+        *
+        *  @param  bool        I'm Sure.
+        *  @return bool true/false;
+        */
+       function delete($sure) {
+               if (!$sure) {
+                       $this->setMissingParamsError();
+                       return false;
+               }
+               if (!$this->userIsAdmin()) {
+                       $this->setPermissionDeniedError();
+                       return false;
+               }
+               db_begin();
+               db_query("DELETE FROM artifact_extra_field_data
+                       WHERE artifact_id='".$this->getID()."'");
+//echo '0.1'.db_error();
+               db_query("DELETE FROM artifact_file
+                       WHERE artifact_id='".$this->getID()."'");
+//echo '6'.db_error();
+               db_query("DELETE FROM artifact_message
+                       WHERE artifact_id='".$this->getID()."'");
+//echo '7'.db_error();
+               db_query("DELETE FROM artifact_history
+                       WHERE artifact_id='".$this->getID()."'");
+//echo '8'.db_error();
+               db_query("DELETE FROM artifact_monitor
+                       WHERE rtifact_id='".$this->getID()."'");
+//echo '9'.db_error();
+               db_query("DELETE FROM artifact
+                       WHERE artifact_id='".$this->getID()."'");
+               if ($this->getStatusID() == 1) {
+                       db_query("UPDATE artifact_counts_agg
+                               SET count=count-1,open_count=open_count-1
+                               WHERE group_artifact_id='".$this->getID()."'");
+               } elseif ($this->getStatusID() == 2) {
+                       db_query("UPDATE artifact_counts_agg
+                               SET count=count-1
+                               WHERE group_artifact_id='".$this->getID()."'");
+               }
+//echo '5'.db_error();
+               db_commit();
+       }
+
+       /**
         *  setMonitor - user can monitor this artifact.
         *
         *  @return false - always false - always use the getErrorMessage() for 
feedback





reply via email to

[Prev in Thread] Current Thread [Next in Thread]