[AppDB] link bugs patch 4 of 6 (resend)

Tony Lambregts tony.lambregts at gmail.com
Sun Jul 10 22:37:11 CDT 2005


(I forgot to delete the buglinks when deleteing a version.)

This is the fourth of the patches that gives better integration of
bugzilla with the AppDB. They are submitted in the order that they
should be applied. If you want to test them out you should download the
tarball for bugzilla from ftp://ftp.winehq.org/pub/wine/ (Thanks Jeremy...)

Change Log: Modify the version object to include an array of bugs (and use that
             array when deleteing a version.

Files changed: include/version.php




-------------- next part --------------
Index: include/version.php
===================================================================
RCS file: /home/wine/appdb/include/version.php,v
retrieving revision 1.25
diff -u -r1.25 version.php
--- include/version.php	30 Jun 2005 01:59:32 -0000	1.25
+++ include/version.php	11 Jul 2005 03:32:46 -0000
@@ -7,6 +7,7 @@
 require_once(BASE."include/comment.php");
 require_once(BASE."include/url.php");
 require_once(BASE."include/screenshot.php");
+require_once(BASE."include/bugs.php");
 
 /**
  * Version class for handling versions.
@@ -25,6 +26,7 @@
     var $aCommentsIds;        // an array that contains the commentId of every comment linked to this version
     var $aScreenshotsIds;     // an array that contains the screenshotId of every screenshot linked to this version
     var $aUrlsIds;            // an array that contains the screenshotId of every url linked to this version
+    var $aBuglinkIds;         // an array that contains the buglinkId of every bug linked to this version
 
     /**    
      * constructor, fetches the data.
@@ -111,6 +113,22 @@
                         $this->aUrlsIds[] = $oRow->id;
                 }
             }
+
+            /*
+             * We fetch Bug linkIds. 
+             */
+            $this->aBuglinkIds = array();
+            $sQuery = "SELECT *
+                       FROM buglinks
+                       WHERE versionId = ".$iVersionId."
+                       ORDER BY bug_id";
+            if($hResult = query_appdb($sQuery))
+            {
+                while($oRow = mysql_fetch_object($hResult))
+                {
+                    $this->aBuglinkIds[] = $oRow->linkId;
+                }
+            }
         }
     }
 
@@ -250,6 +268,11 @@
         {
             $oUrl = new Url($iUrlId);
             $oUrl->delete($bSilent);
+        }
+        foreach($this->$aBuglinkIds as $iBug_id)
+        {
+            $oBug = new bug($iBug_id);
+            $oBug->delete($bSilent);
         }
 
         // remove any maintainers for this version so we don't orphan them


More information about the wine-patches mailing list