Add a moveChildren method to the objectManager and implement objectMoveChildren for version

and version_queue. Use this to move versions.
This commit is contained in:
Alexander Nicolaysen Sørnes
2007-04-23 23:31:24 +00:00
committed by WineHQ
parent 886cdeafa3
commit cf81d542ee
5 changed files with 109 additions and 4 deletions

View File

@@ -1366,6 +1366,49 @@ class Version {
echo "<p>To view a submission, click on its name. ".
"From that page you can edit, delete or approve it into the AppDB.</p>\n";
}
function objectMoveChildren($iNewId)
{
/* Keep track of how many items we have updated */
$iCount = 0;
/* Move test results */
$sQuery = "SELECT * FROM testResults WHERE versionId = '?'";
$hResult = query_parameters($sQuery, $this->iVersionId);
if(!$hResult)
return FALSE;
while($oRow = mysql_fetch_object($hResult))
{
$oTestData = new testData($oRow->testingId);
$oTestData->iVersionId = $iNewId;
if($oTestData->update())
$iCount++;
else
return FALSE;
}
/* Move all app data */
$sQuery = "SELECT * FROM appData WHERE versionId = '?'";
$hResult = query_parameters($sQuery, $this->iVersionId);
if(!$hResult)
return FALSE;
while($oRow = mysql_fetch_object($hResult))
{
$oAppData = new appData($oRow->testingId);
$oAppData->iVersionId = $iNewId;
if($oAppData->update(TRUE))
$iCount++;
else
return FALSE;
}
/* Return the number of updated objects if everything was successful */
return $iCount;
}
}
?>