Return true when creating duplicate distributions
This commit is contained in:
committed by
WineHQ
parent
aefbc6de57
commit
bab429ee90
@@ -82,14 +82,21 @@ class distribution {
|
|||||||
//Let's not create a duplicate
|
//Let's not create a duplicate
|
||||||
$sQuery = "SELECT *
|
$sQuery = "SELECT *
|
||||||
FROM distributions
|
FROM distributions
|
||||||
WHERE name LIKE '?'";
|
WHERE name = '?'";
|
||||||
$hDuplicate = query_parameters($sQuery, $this->sName);
|
$hResult = query_parameters($sQuery, $this->sName);
|
||||||
if(!mysql_num_rows($hDuplicate) == 0)
|
|
||||||
|
if($hResult && $oRow = mysql_fetch_object($hResult))
|
||||||
{
|
{
|
||||||
addmsg("There was an existing Distribution called ".$this->sName.".", "red");
|
if(mysql_num_rows($hResult))
|
||||||
$oRow = mysql_fetch_object($hDuplicate);
|
{
|
||||||
$this->iDistributionId = $oRow->distributionId;
|
addmsg("There was an existing distribution called ".$this->sName.".", "red");
|
||||||
return false;
|
$this->distribution($oRow->distributionId);
|
||||||
|
|
||||||
|
/* Even though we did not create a new distribution, the caller is provided
|
||||||
|
with a valid distribution object. Thus no special handling is necessary,
|
||||||
|
so we return TRUE */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$hResult = query_parameters("INSERT INTO distributions (name, url, submitterId, queued) ".
|
$hResult = query_parameters("INSERT INTO distributions (name, url, submitterId, queued) ".
|
||||||
|
|||||||
Reference in New Issue
Block a user