Add arrays for monitors, fix array for test results and use the arrays to delete monitors and bug links when a version is deleted

This commit is contained in:
Tony Lambregts
2005-10-29 04:41:10 +00:00
committed by WineHQ
parent d1ebda9a8d
commit 7bbe114e6d
3 changed files with 37 additions and 10 deletions

View File

@@ -7,10 +7,12 @@
* application environment * application environment
*/ */
include("path.php"); include("path.php");
include(BASE."include/incl.php"); require_once(BASE."include/incl.php");
include(BASE."include/category.php"); require_once(BASE."include/category.php");
include(BASE."include/application.php"); require_once(BASE."include/application.php");
include(BASE."include/mail.php"); require_once(BASE."include/mail.php");
require_once(BASE."include/monitor.php");
if($_REQUEST['confirmed'] != "yes") if($_REQUEST['confirmed'] != "yes")
{ {

View File

@@ -23,7 +23,7 @@ class Monitor {
{ {
$sQuery = "SELECT * $sQuery = "SELECT *
FROM appMonitors FROM appMonitors
WHERE MonitorId = '".$iMonitorId."'"; WHERE monitorId = '".$iMonitorId."'";
$hResult = query_appdb($sQuery); $hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult); $oRow = mysql_fetch_object($hResult);
$this->iMonitorId = $oRow->monitorId; $this->iMonitorId = $oRow->monitorId;
@@ -85,7 +85,7 @@ class Monitor {
*/ */
function delete($bSilent=false) 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) if(!$bSilent)
$this->SendNotificationMail("delete"); $this->SendNotificationMail("delete");
} }

View File

@@ -8,7 +8,6 @@ require_once(BASE."include/comment.php");
require_once(BASE."include/url.php"); require_once(BASE."include/url.php");
require_once(BASE."include/screenshot.php"); require_once(BASE."include/screenshot.php");
require_once(BASE."include/bugs.php"); require_once(BASE."include/bugs.php");
//require_once(BASE."include/testResults.php");
/** /**
* Version class for handling versions. * Version class for handling versions.
@@ -29,7 +28,8 @@ class Version {
var $aScreenshotsIds; // an array that contains the screenshotId of every screenshot 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 $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 $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. * constructor, fetches the data.
@@ -134,7 +134,7 @@ class Version {
} }
/* /*
* We fetch Test ResultsIds. * We fetch Test Results Ids.
*/ */
$this->aTestingIds = array(); $this->aTestingIds = array();
$sQuery = "SELECT * $sQuery = "SELECT *
@@ -145,7 +145,22 @@ class Version {
{ {
while($oRow = mysql_fetch_object($hResult)) 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 @@ class Version {
$oBug = new bug($iBug_id); $oBug = new bug($iBug_id);
$oBug->delete($bSilent); $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 // remove any maintainers for this version so we don't orphan them
$sQuery = "DELETE from appMaintainers WHERE versionId='".$this->iVersionId."';"; $sQuery = "DELETE from appMaintainers WHERE versionId='".$this->iVersionId."';";