appdb/include distribution.php
WineHQ
wineowner at wine.codeweavers.com
Fri May 25 20:37:25 CDT 2007
ChangeSet ID: 31133
CVSROOT: /opt/cvs-commit
Module name: appdb
Changes by: wineowner at winehq.org 2007/05/25 20:37:25
Modified files:
include : distribution.php
Log message:
Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Return true when creating duplicate distributions
Patch: http://cvs.winehq.org/patch.py?id=31133
Old revision New revision Changes Path
1.30 1.31 +15 -8 appdb/include/distribution.php
Index: appdb/include/distribution.php
diff -u -p appdb/include/distribution.php:1.30 appdb/include/distribution.php:1.31
--- appdb/include/distribution.php:1.30 26 May 2007 1:37:25 -0000
+++ appdb/include/distribution.php 26 May 2007 1:37:25 -0000
@@ -82,14 +82,21 @@ class distribution {
//Let's not create a duplicate
$sQuery = "SELECT *
FROM distributions
- WHERE name LIKE '?'";
- $hDuplicate = query_parameters($sQuery, $this->sName);
- if(!mysql_num_rows($hDuplicate) == 0)
- {
- addmsg("There was an existing Distribution called ".$this->sName.".", "red");
- $oRow = mysql_fetch_object($hDuplicate);
- $this->iDistributionId = $oRow->distributionId;
- return false;
+ WHERE name = '?'";
+ $hResult = query_parameters($sQuery, $this->sName);
+
+ if($hResult && $oRow = mysql_fetch_object($hResult))
+ {
+ if(mysql_num_rows($hResult))
+ {
+ addmsg("There was an existing distribution called ".$this->sName.".", "red");
+ $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) ".
More information about the wine-cvs
mailing list