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:
committed by
WineHQ
parent
886cdeafa3
commit
cf81d542ee
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user