[AppDb] add arrays for monitors and delete monitors and bug links
when a version is deleted.
Tony Lambregts
tony.lambregts at gmail.com
Fri Oct 28 22:58:36 CDT 2005
Change Log: Add array for monitors, fix array for test results and use
the arrays to delete monitors and bug links when a version is deleted.
Files changed: admin/deleteAny.php include/monitor.php include/version.php
-------------- next part --------------
Index: admin/deleteAny.php
===================================================================
RCS file: /home/wine/appdb/admin/deleteAny.php,v
retrieving revision 1.14
diff -u -r1.14 deleteAny.php
--- admin/deleteAny.php 26 Oct 2005 02:09:49 -0000 1.14
+++ admin/deleteAny.php 29 Oct 2005 03:42:54 -0000
@@ -7,10 +7,12 @@
* application environment
*/
include("path.php");
-include(BASE."include/incl.php");
-include(BASE."include/category.php");
-include(BASE."include/application.php");
-include(BASE."include/mail.php");
+require_once(BASE."include/incl.php");
+require_once(BASE."include/category.php");
+require_once(BASE."include/application.php");
+require_once(BASE."include/mail.php");
+require_once(BASE."include/monitor.php");
+
if($_REQUEST['confirmed'] != "yes")
{
Index: include/monitor.php
===================================================================
RCS file: /home/wine/appdb/include/monitor.php,v
retrieving revision 1.1
diff -u -r1.1 monitor.php
--- include/monitor.php 30 Sep 2005 01:55:51 -0000 1.1
+++ include/monitor.php 29 Oct 2005 03:42:55 -0000
@@ -23,7 +23,7 @@
{
$sQuery = "SELECT *
FROM appMonitors
- WHERE MonitorId = '".$iMonitorId."'";
+ WHERE monitorId = '".$iMonitorId."'";
$hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult);
$this->iMonitorId = $oRow->monitorId;
@@ -85,7 +85,7 @@
*/
function delete($bSilent=false)
{
- $hResult = query_appdb("DELETE FROM appMonitors WHERE MonitorId = '".$this->iMonitorId."'");
+ $hResult = query_appdb("DELETE FROM appMonitors WHERE monitorId = '".$this->iMonitorId."'");
if(!$bSilent)
$this->SendNotificationMail("delete");
}
Index: include/version.php
===================================================================
RCS file: /home/wine/appdb/include/version.php,v
retrieving revision 1.41
diff -u -r1.41 version.php
--- include/version.php 28 Oct 2005 00:32:20 -0000 1.41
+++ include/version.php 29 Oct 2005 03:42:55 -0000
@@ -8,7 +8,6 @@
require_once(BASE."include/url.php");
require_once(BASE."include/screenshot.php");
require_once(BASE."include/bugs.php");
-//require_once(BASE."include/testResults.php");
/**
* Version class for handling versions.
@@ -29,7 +28,8 @@
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
- var $aTestingIds; // an array that contains the buglinkId of every bug linked to this version
+ var $aTestingIds; // an array that contains the testingId of every test result linked to this version
+ var $aMonitorIds; // an array that contains the monitorId of every monitor linked to this version
/**
* constructor, fetches the data.
@@ -134,7 +134,7 @@
}
/*
- * We fetch Test ResultsIds.
+ * We fetch Test Results Ids.
*/
$this->aTestingIds = array();
$sQuery = "SELECT *
@@ -145,7 +145,22 @@
{
while($oRow = mysql_fetch_object($hResult))
{
- $this->aTestingIds[] = $oRow->linkId;
+ $this->aTestingIds[] = $oRow->testingId;
+ }
+ }
+ /*
+ * We fetch monitor Ids.
+ */
+ $this->aTestingIds = array();
+ $sQuery = "SELECT *
+ FROM appMonitors
+ WHERE versionId = ".$iVersionId."
+ ORDER BY monitorId";
+ if($hResult = query_appdb($sQuery))
+ {
+ while($oRow = mysql_fetch_object($hResult))
+ {
+ $this->aMonitorIds[] = $oRow->monitorId;
}
}
}
@@ -297,6 +312,16 @@
$oBug = new bug($iBug_id);
$oBug->delete($bSilent);
}
+ foreach($this->aTestingIds as $iTestId)
+ {
+ $oTest = new testData($iTestId);
+ $oTest->delete($bSilent);
+ }
+ foreach($this->aMonitorIds as $iMonitorId)
+ {
+ $oMonitor = new Monitor($iMonitorId);
+ $oMonitor->delete($bSilent);
+ }
// remove any maintainers for this version so we don't orphan them
$sQuery = "DELETE from appMaintainers WHERE versionId='".$this->iVersionId."';";
More information about the wine-patches
mailing list