Add initial un-delete support

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-12-12 22:43:22 +01:00
committed by Chris Morgan
parent 5a31b9d5c8
commit 8c7bd3a5e9
28 changed files with 345 additions and 96 deletions

View File

@@ -54,6 +54,11 @@ class appData
}
}
function purge()
{
return $this->delete();
}
function delete()
{
if(!$this->canEdit())
@@ -499,7 +504,7 @@ class appData
} else if($this->iAppId)
{
$oApp = new application($this->iAppId);
if($oApp->canEdit() && $oApp->objectGetQueueState() == 'accepted')
if($oApp->canEdit() && $oApp->objectGetState() == 'accepted')
return FALSE;
else
return TRUE;

View File

@@ -100,15 +100,20 @@ class Application {
}
}
private function _internal_retrieve_all_versions($bIncludeObsolete = TRUE)
private function _internal_retrieve_all_versions($bIncludeObsolete = TRUE, $bIncludeDeleted = false)
{
if(!$bIncludeObsolete)
$sObsolete = " AND obsoleteBy = '0'";
else
$sObsolete = "";
if($bIncludeDeleted)
$sExcludeDeleted = "";
else
$sExcludeDeleted = " AND state != 'deleted'";
$sQuery = "SELECT versionId FROM appVersion WHERE
appId = '?'$sObsolete ORDER by versionName";
appId = '?'$sObsolete$sExcludeDeleted ORDER by versionName";
$hResult = query_parameters($sQuery, $this->iAppId);
return $hResult;
}
@@ -236,8 +241,37 @@ class Application {
return true;
}
/**
* Deletes the application from the database.
/**
* Deletes the application from the database.
* and request the deletion of linked elements.
*/
public function purge()
{
$bSuccess = true;
/* make sure the current user has the appropriate permission to delete
this application */
if(!$_SESSION['current']->canDeleteApplication($this))
return false;
foreach($this->objectGetChildren(true) as $oChild)
{
if(!$oChild->purge())
$bSuccess = FALSE;
}
/* Flag the entry as deleted */
$sQuery = "DELETE FROM appFamily
WHERE appId = '?'
LIMIT 1";
if(!($hResult = query_parameters($sQuery, $this->iAppId)))
$bSuccess = false;
return $bSuccess;
}
/**
* Falgs the application as deleted
* and request the deletion of linked elements.
*/
public function delete()
@@ -255,7 +289,8 @@ class Application {
$bSuccess = FALSE;
}
$sQuery = "DELETE FROM appFamily
/* Flag the entry as deleted */
$sQuery = "UPDATE appFamily SET state = 'deleted'
WHERE appId = '?'
LIMIT 1";
if(!($hResult = query_parameters($sQuery, $this->iAppId)))
@@ -1090,7 +1125,7 @@ class Application {
return $oRow->count;
}
public function getVersions($bIncludeObsolete = TRUE)
public function getVersions($bIncludeObsolete = TRUE, $bIncludeDeleted = false)
{
/* If no id is set we cannot query for the versions, but perhaps objects are already cached? */
if(!$this->iAppId)
@@ -1098,7 +1133,7 @@ class Application {
$aVersions = array();
$hResult = $this->_internal_retrieve_all_versions($bIncludeObsolete);
$hResult = $this->_internal_retrieve_all_versions($bIncludeObsolete, $bIncludeDeleted);
while($oRow = mysql_fetch_object($hResult))
$aVersions[] = new version($oRow->versionId);
@@ -1129,14 +1164,14 @@ class Application {
return $sMsg;
}
public function objectGetChildren()
public function objectGetChildren($bIncludeDeleted = false)
{
$aChildren = array();
/* Get versions */
foreach($this->getVersions() as $oVersion)
foreach($this->getVersions(true, $bIncludeDeleted) as $oVersion)
{
$aChildren += $oVersion->objectGetChildren();
$aChildren += $oVersion->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oVersion;
}
@@ -1150,7 +1185,7 @@ class Application {
while($oRow = mysql_fetch_object($hResult))
{
$oUrl = new url(0, $oRow);
$aChildren += $oUrl->objectGetChildren();
$aChildren += $oUrl->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oUrl;
}
@@ -1164,7 +1199,7 @@ class Application {
while($oRow = mysql_fetch_object($hResult))
{
$oMaintainer = new maintainer(0, $oRow);
$aChildren += $oMaintainer->objectGetChildren();
$aChildren += $oMaintainer->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oMaintainer;
}

View File

@@ -113,6 +113,25 @@ class application_queue
$this->oApp->reject();
}
function purge()
{
$bSuccess = TRUE;
if(!$this->oApp->purge())
$bSuccess = FALSE;
/* When deleting a duplicate app in the application queue, the version is moved
to another app and so when application_queue::delete() is called there is
no version child to delete, so check if the versionId is valid */
if($this->oVersionQueue->oVersion->iVersionId)
{
if(!$this->oVersionQueue->purge())
$bSuccess = FALSE;
}
return $bSuccess;
}
function delete()
{
$bSuccess = TRUE;
@@ -132,9 +151,9 @@ class application_queue
return $bSuccess;
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
return $this->oApp->objectGetChildren();
return $this->oApp->objectGetChildren($bIncludeDeleted);
}
function objectGetSubmitterId()

View File

@@ -145,6 +145,11 @@ class Bug
}
}
function purge()
{
return $this->delete();
}
/**
* Deletes the Bug from the database.
* and request its deletion from the filesystem (including the thumbnail).
@@ -273,7 +278,7 @@ class Bug
return array(null, null, null);
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
return array();
}

View File

@@ -171,6 +171,10 @@ class Comment {
return true;
}
function purge()
{
return $this->delete();
}
/**
* Removes the current comment from the database.
@@ -456,7 +460,7 @@ class Comment {
return array($sSubject, $sMessage, $aRecipients);
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
return array();
}

View File

@@ -142,6 +142,38 @@ class distribution {
}
}
function purge()
{
/* Is the current user allowed to delete this distribution? We allow
everyone to delete a queued, empty distribution, because it should be
deleted along with the last testData associated with it */
if(!($this->canEdit() || (!sizeof($this->aTestingIds) &&
$this->sState != 'accepted')))
return false;
// if the distribution has test results only enable an admin to delete
// the distribution
if(sizeof($this->aTestingIds) && !$_SESSION['current']->hasPriv("admin"))
return FALSE;
$bSuccess = TRUE;
foreach($this->objectGetChildren(true) as $oChild)
{
if(!$oChild->purge())
$bSuccess = FALSE;
}
// now delete the Distribution
$sQuery = "DELETE FROM distributions
WHERE distributionId = '?'
LIMIT 1";
if(!($hResult = query_parameters($sQuery, $this->iDistributionId)))
$bSuccess = FALSE;
return $bSuccess;
}
// Delete Distributution.
function delete()
{
@@ -166,7 +198,7 @@ class distribution {
}
// now delete the Distribution
$sQuery = "DELETE FROM distributions
$sQuery = "UPDATE distributions SET state = 'deleted'
WHERE distributionId = '?'
LIMIT 1";
if(!($hResult = query_parameters($sQuery, $this->iDistributionId)))
@@ -175,7 +207,6 @@ class distribution {
return $bSuccess;
}
// Move Distribution out of the queue.
function unQueue()
{
@@ -217,10 +248,15 @@ class distribution {
return $this->delete();
}
function getTestResults()
function getTestResults($bIncludeDeleted = false)
{
if($bIncludeDeleted)
$sExcludeDeleted = "";
else
$sExcludeDeleted = " AND state != 'deleted'";
$aTests = array();
$sQuery = "SELECT * FROM testResults WHERE distributionId = '?'";
$sQuery = "SELECT * FROM testResults WHERE distributionId = '?'$sExcludeDeleted";
$hResult = query_parameters($sQuery, $this->iDistributionId);
while($oRow = mysql_fetch_object($hResult))
@@ -229,13 +265,13 @@ class distribution {
return $aTests;
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
$aChildren = array();
foreach($this->getTestResults() as $oTest)
foreach($this->getTestResults($bIncludeDeleted) as $oTest)
{
$aChildren += $oTest->objectGetChildren();
$aChildren += $oTest->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oTest;
}

View File

@@ -63,7 +63,7 @@ class downloadurl
return $sReturn;
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
/* We have none */
return array();
@@ -395,6 +395,11 @@ class downloadurl
return TRUE;
}
function purge()
{
return $this->delete();
}
function delete()
{
if(!downloadurl::canEdit($this->iVersionId))

View File

@@ -334,6 +334,11 @@ class maintainer
return TRUE;
}
function purge()
{
return $this->delete();
}
function delete()
{
$sQuery = "DELETE from appMaintainers where maintainerId = '?'";
@@ -875,7 +880,7 @@ class maintainer
return array($aItemsPerPage, $iDefaultPerPage);
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
/* We have none */
return array();

View File

@@ -61,7 +61,7 @@ class Monitor {
}
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
/* We have none */
return array();
@@ -169,6 +169,11 @@ class Monitor {
return array($sSubject, $sMsg, $aMailTo);
}
function purge()
{
return $this->delete();
}
/**
* Removes the current Monitor from the database.
* Informs interested people about the deletion.

View File

@@ -119,6 +119,10 @@ class Note {
return true;
}
function purge()
{
return $this->delete();
}
/**
* Removes the current note from the database.
@@ -355,7 +359,7 @@ class Note {
return array(null, null, null);
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
return array();
}

View File

@@ -125,6 +125,10 @@ class screenshot
}
}
function purge()
{
return $this->delete();
}
/**
* Deletes the screenshot from the database.
@@ -290,7 +294,7 @@ class screenshot
return $this->oScreenshotImage->get_width();
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
/* We have none */
return array();

View File

@@ -223,7 +223,29 @@ class testData{
return false;
}
}
// Purge test results from the database
function purge()
{
// is the current user allowed to delete this test result?
$oVersion = new Version($this->iVersionId);
if(!$_SESSION['current']->hasPriv("admin") &&
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion) &&
!(($_SESSION['current']->iUserId == $this->iSubmitterId) && !($this->sState == 'accepted')))
{
return false;
}
// now we delete the data
$sQuery = "DELETE FROM testResults
WHERE testingId = '?'
LIMIT 1";
if(!($hResult = query_parameters($sQuery, $this->iTestingId)))
return false;
return true;
}
// Delete test results.
function delete()
{
@@ -236,8 +258,8 @@ class testData{
return false;
}
// now delete the test data
$sQuery = "DELETE FROM testResults
// now we flag the data as deleted
$sQuery = "UPDATE testResults SET state = 'deleted'
WHERE testingId = '?'
LIMIT 1";
if(!($hResult = query_parameters($sQuery, $this->iTestingId)))
@@ -1163,7 +1185,7 @@ class testData{
return TRUE;
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
/* We have none */
return array();

View File

@@ -22,6 +22,21 @@ class testData_queue
return $this->oTestData->create();
}
function purge()
{
$bSuccess = $this->oTestData->purge();
/* We delete the distribution if it has not been approved and is not associated
with any other testData. Otherwise we would have to have a distribution
queue for admins to clean up unused, queued entries */
$this->oDistribution = new distribution($this->oDistribution->iDistributionId);
if(!sizeof($this->oDistribution->aTestingIds) &&
$this->oDistribution->canEdit())
$this->oDistribution->purge();
return $bSuccess;
}
function delete()
{
$bSuccess = $this->oTestData->delete();
@@ -198,9 +213,9 @@ class testData_queue
return $this->oTestData->objectGetSubmitterId();
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
return $this->oTestData->objectGetChildren();
return $this->oTestData->objectGetChildren($bIncludeDeleted);
}
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)

View File

@@ -86,6 +86,10 @@ class Url {
return true;
}
function purge()
{
return $this->delete();
}
/**
* Deletes the url from the database.
@@ -506,7 +510,7 @@ class Url {
return array(null, null, null);
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
return array();
}

View File

@@ -144,9 +144,32 @@ class Vendor {
return true;
}
/**
* Remove the vendor from the database.
*/
function purge()
{
if(sizeof($this->aApplicationsIds)>0)
{
return FALSE;
} else
{
$sQuery = "DELETE FROM vendor
WHERE vendorId = '?'
LIMIT 1";
if(query_parameters($sQuery, $this->iVendorId))
{
return TRUE;
}
return FALSE;
}
return false;
}
/**
* Deletes the vendor from the database.
* Flag the vendor as deleted
*/
function delete()
{
@@ -155,7 +178,7 @@ class Vendor {
return FALSE;
} else
{
$sQuery = "DELETE FROM vendor
$sQuery = "UPDATE vendor SET state = 'deleted'
WHERE vendorId = '?'
LIMIT 1";
if(query_parameters($sQuery, $this->iVendorId))
@@ -307,7 +330,7 @@ class Vendor {
return new mailOptions();
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
/* We don't have any */
return array();

View File

@@ -251,9 +251,40 @@ class version {
return true;
}
/**
* Removes the version from the database and
* requests the same action for child entries
*/
public function purge()
{
/* We need the versionId to continue */
if(!$this->iVersionId)
return;
/**
* Deletes the version from the database.
/* is the current user allowed to delete this version? */
if(!$_SESSION['current']->canDeleteVersion($this))
return false;
$bSuccess = TRUE;
foreach($this->objectGetChildren(TRUE) as $oChild)
{
if(!$oChild->purge())
$bSuccess = FALSE;
}
/* now remove the version from the DB */
$hResult = query_parameters("DELETE FROM appVersion
WHERE versionId = '?'
LIMIT 1", $this->iVersionId);
if(!$hResult)
$bSuccess = FALSE;
return $bSuccess;
}
/**
* Flags the version as deleted
* and request the deletion of linked elements.
*/
public function delete()
@@ -274,8 +305,8 @@ class version {
$bSuccess = FALSE;
}
/* now delete the version */
$hResult = query_parameters("DELETE FROM appVersion
/* now flag the version as deleted */
$hResult = query_parameters("UPDATE appVersion SET state = 'deleted'
WHERE versionId = '?'
LIMIT 1", $this->iVersionId);
if(!$hResult)
@@ -1591,17 +1622,22 @@ class version {
"From that page you can edit, delete or approve it into the AppDB.</p>\n";
}
public function getTestResults()
public function getTestResults($bIncludeDeleted = false)
{
/* If we don't have an id we can query the database, but perhaps we
/* If we don't have an id we can't query the database, but perhaps we
have some cached entries? */
if(!$this->iVersionId)
return $this->aTestResults;
$aTests = array();
if($bIncludeDeleted)
$sExcludeDeleted = "";
else
$sExcludeDeleted = " AND state != 'deleted'";
/* Find test results */
$sQuery = "SELECT * FROM testResults WHERE versionId = '?'";
$sQuery = "SELECT * FROM testResults WHERE versionId = '?'$sExcludeDeleted";
$hResult = query_parameters($sQuery, $this->iVersionId);
if(!$hResult)
@@ -1613,13 +1649,13 @@ class version {
return $aTests;
}
public function objectGetChildren()
public function objectGetChildren($bIncludeDeleted = false)
{
$aChildren = array();
foreach($this->getTestResults() as $oTest)
foreach($this->getTestResults($bIncludeDeleted) as $oTest)
{
$aChildren += $oTest->objectGetChildren();
$aChildren += $oTest->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oTest;
}
@@ -1633,7 +1669,7 @@ class version {
while($oRow = mysql_fetch_object($hResult))
{
$oMaintainer = new maintainer(0, $oRow);
$aChildren += $oMaintainer->objectGetChildren();
$aChildren += $oMaintainer->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oMaintainer;
}
@@ -1647,7 +1683,7 @@ class version {
while($oRow = mysql_fetch_object($hResult))
{
$oMonitor = new monitor(0, $oRow);
$aChildren += $oMonitor->objectGetChildren();
$aChildren += $oMonitor->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oMonitor;
}
@@ -1661,7 +1697,7 @@ class version {
while($oRow = mysql_fetch_object($hResult))
{
$oNote = new note(0, $oRow);
$aChildren += $oNote->objectGetChildren();
$aChildren += $oNote->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oNote;
}
@@ -1675,7 +1711,7 @@ class version {
while($oRow = mysql_fetch_object($hResult))
{
$oScreenshot = new screenshot(0, $oRow);
$aChildren += $oScreenshot->objectGetChildren();
$aChildren += $oScreenshot->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oScreenshot;
}
@@ -1683,7 +1719,7 @@ class version {
foreach($this->get_buglink_ids() as $iBugId)
{
$oBug = new bug($iBugId);
$aChildren += $oBug->objectGetChildren();
$aChildren += $oBug->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oBug;
}
@@ -1697,7 +1733,7 @@ class version {
while($oRow = mysql_fetch_object($hResult))
{
$oComment = new comment(0, $oRow);
$aChildren += $oComment->objectGetChildren();
$aChildren += $oComment->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oComment;
}
@@ -1711,7 +1747,7 @@ class version {
while($oRow = mysql_fetch_object($hResult))
{
$oUrl = new url(0, $oRow);
$aChildren += $oUrl->objectGetChildren();
$aChildren += $oUrl->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oUrl;
}
@@ -1725,7 +1761,7 @@ class version {
while($oRow = mysql_fetch_object($hResult))
{
$oDownload = new downloadurl(0, $oRow);
$aChildren += $oDownload->objectGetChildren();
$aChildren += $oDownload->objectGetChildren($bIncludeDeleted);
$aChildren[] = $oDownload;
}

View File

@@ -72,6 +72,22 @@ class version_queue
$this->oTestDataQueue->update();
}
function purge()
{
$bSuccess = TRUE;
if(!$this->oVersion->purge())
$bSuccess = FALSE;
if(!$this->oTestDataQueue->purge())
$bSuccess = FALSE;
if($this->oDownloadUrl->iId && !$this->oDownloadUrl->purge())
$bSuccess = FALSE;
return $bSuccess;
}
function delete()
{
$bSuccess = TRUE;
@@ -100,9 +116,9 @@ class version_queue
return $this->oVersion->objectGetSubmitterId();
}
function objectGetChildren()
function objectGetChildren($bIncludeDeleted = false)
{
return $this->oVersion->objectGetChildren();
return $this->oVersion->objectGetChildren($bIncludeDeleted);
}
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)

View File

@@ -147,6 +147,11 @@ class voteManager
return TRUE;
}
function purge()
{
return $this->delete();
}
public function delete()
{
$bSuccess = TRUE;

View File

@@ -23,7 +23,7 @@ create table vendor (
vendorId int not null auto_increment,
vendorName varchar(100) not null,
vendorURL varchar(200),
state enum('accepted','queued') NOT NULL default 'accepted',
state enum('accepted','queued','deleted') NOT NULL default 'accepted',
key(vendorId)
);
@@ -41,7 +41,7 @@ create table appFamily (
catId int,
submitTime datetime NOT NULL,
submitterId int(11) NOT NULL default '0',
state enum('accepted','queued','rejected') NOT NULL default 'accepted',
state enum('accepted','queued','rejected','deleted') NOT NULL default 'accepted',
key(appId)
);
@@ -60,7 +60,7 @@ create table appVersion (
submitterId int(11) NOT NULL default '0',
license enum('Retail','Open Source','Freeware','Demo','Shareware'),
obsoleteBy int(11) NOT NULL default '0',
state enum('accepted','queued','rejected','pending') NOT NULL default 'accepted',
state enum('accepted','queued','rejected','pending','deleted') NOT NULL default 'accepted',
key(versionId),
index(appId)
);

View File

@@ -11,7 +11,7 @@ create table distributions (
url varchar(255) default NULL,
submitTime datetime NOT NULL,
submitterId int(11) NOT NULL default '0',
state enum('accepted','queued') NOT NULL default 'accepted',
state enum('accepted','queued','deleted') NOT NULL default 'accepted',
key(distributionId),
index(name)
);

View File

@@ -20,6 +20,6 @@ create table testResults (
comments text,
submitTime datetime NOT NULL,
submitterId int(11) NOT NULL default '0',
state enum('accepted','queued','rejected','pending') NOT NULL default 'accepted',
state enum('accepted','queued','rejected','pending','deleted') NOT NULL default 'accepted',
key(testingId)
);

View File

@@ -43,7 +43,7 @@ function test_appData_listSubmittedBy()
}
/* Clean up */
if(!$oDownloadUrl->delete())
if(!$oDownloadUrl->purge())
{
$bSuccess = false;
error("Failed to delete oDownloadUrl!");

View File

@@ -7,7 +7,7 @@ require_once(BASE.'include/version.php');
require_once(BASE.'include/application.php');
require_once("test_common.php");
/* test that Application::delete() properly deletes data dependent on */
/* test that Application::purge() properly deletes data dependent on */
/* having an application */
//TODO: need to test that we delete all urls, maintainers and other things
// tested under an application
@@ -210,9 +210,9 @@ function test_application_getWithRating()
function delete_app_and_user($oApp, $oUser)
{
$bSuccess = true;
if(!$oApp->delete())
if(!$oApp->purge())
{
echo __FUNCTION__."() oApp->delete() failed\n";
echo __FUNCTION__."() oApp->purge() failed\n";
$bSuccess = false;
}

View File

@@ -40,9 +40,9 @@ function delete_version_and_parent_app($iVersionId)
$oVersion = new version($iVersionId);
$oApp = new application($oVersion->iAppId);
if(!$oApp->delete())
if(!$oApp->purge())
{
echo __FUNCTION__."() oApp->delete() failed, returned false!\n";
echo __FUNCTION__."() oApp->purge() failed, returned false!\n";
}
// remove the admin privleges only if the user didn't

View File

@@ -200,7 +200,7 @@ function test_maintainer_getAppsMaintained()
/* remove this application */
$oApp = new Application($iAppId);
$oApp->delete();
$oApp->purge();
$oUser->delete();
@@ -461,7 +461,7 @@ function test_superMaintainerOnAppSubmit()
Maintainer::deleteMaintainer($oUser, $iAppId);
$oApp->delete();
$oApp->purge();
$oUser->delete();
return true;
@@ -549,7 +549,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Failed to get list of maintainers!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -560,7 +560,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Got super maintainer count of $iReceived instead of $iExpected!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -569,7 +569,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Failed to get list of maintainers!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -608,7 +608,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Failed to get list of maintainers!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -619,7 +619,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Got maintainer count of $iReceived instead of $iExpected!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -628,7 +628,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Failed to get list of maintainers!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -639,12 +639,12 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Got maintainer count of $iReceived instead of $iExpected!");
$oUser->delete(); // clean up the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
if(!$oApp->delete())
echo __FUNCTION__." oApp->delete() failed\n";
if(!$oApp->purge())
echo __FUNCTION__." oApp->purge() failed\n";
$oUser->delete(); // clean up the user

View File

@@ -15,7 +15,7 @@ class notifyContainer
function cleanup()
{
$this->oTestData->delete(); // deleted the created testData
$this->oTestData->purge(); // deleted the created testData
$this->oMaintainer->delete(); // delete the created maintainer entry
// (Should be deleted when the user is deleted)

View File

@@ -51,7 +51,7 @@ function test_class($sClassName, $aTestMethods)
{
error("Got '$hResult' instead of a valid query handle");
error("FAILED\t\t$sClassName::$sClassName");
$oTestObject->delete();
$oTestObject->purge();
return FALSE;
}
@@ -59,7 +59,7 @@ function test_class($sClassName, $aTestMethods)
{
error("Failed to fetch query object");
error("FAILED\t\t$sClassName::$sClassName");
$oTestObject->delete();
$oTestObject->purge();
return FALSE;
}
@@ -70,7 +70,7 @@ function test_class($sClassName, $aTestMethods)
{
error("Got '$iReceived' instead of a valid id");
error("FAILED\t\t$sClassName::$sClassName()");
$oTestObject->delete();
$oTestObject->purge();
return FALSE;
}
@@ -83,9 +83,9 @@ function test_class($sClassName, $aTestMethods)
if(!$oUser->addPriv("admin"))
error("oUser->addPriv('admin') failed");
if(!$oTestObject->delete())
if(!$oTestObject->purge())
{
error("sClassName of '".$sClassName."' oTestObject->delete() failed!");
error("sClassName of '".$sClassName."' oTestObject->purge() failed!");
$oUser->delete();
return false;
}
@@ -111,13 +111,13 @@ function test_class($sClassName, $aTestMethods)
{
error("Got $iReceived instead of >= $iExpected");
error("FAILED\t\t$sClassName::$sMethod");
$oTestObject->delete();
$oTestObject->purge();
return FALSE;
}
/* Class specific clean-up */
cleanup($oTestObject);
$oTestObject->delete();
$oTestObject->purge();
echo "PASSED\t\t$sClassName::$sMethod\n";
break;
@@ -150,11 +150,11 @@ function cleanup($oObject)
break;
case "version":
$oApp = new application($oObject->iAppId);
$oApp->delete();
$oApp->purge();
break;
case "version_queue":
$oApp = new application($oObject->oVersion->iAppId);
$oApp->delete();
$oApp->purge();
break;
}
}
@@ -253,6 +253,7 @@ function test_object_methods()
"canEdit",
"display",
"getOutputEditorValues",
"mustBeQueued",
"objectGetChildren",
"objectGetEntries",
"objectGetHeader",
@@ -264,7 +265,7 @@ function test_object_methods()
"objectMakeLink",
"objectMakeUrl",
"outputEditor",
"mustBeQueued"
"purge"
);
$aTestClasses = array("application",

View File

@@ -35,14 +35,14 @@ function test_testData_getNewestTestidFromVersionId()
if($iExpected != $iReceived)
{
error("Got testData id of $iReceived instead of $iExpected!");
$oOldTestData->delete();
$oNewTestData->delete();
$oOldTestData->purge();
$oNewTestData->purge();
$oUser->delete();
return FALSE;
}
$oOldTestData->delete();
$oNewTestData->delete();
$oOldTestData->purge();
$oNewTestData->purge();
$oUser->delete();
return TRUE;