ChangeSet ID: 31164 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2007/06/09 10:44:46
Modified files: include : appData.php downloadurl.php version_queue.php tables : appdb_tables.sql
Log message: Alexander Nicolaysen Sørnes alex@thehandofagony.com Fix app/version rejection. Version queue requeue wasn't requeueing its downloadurl, downloadurl class was missing objectManager functionality. Rejected appData wasn't being accounted for.
Patch: http://cvs.winehq.org/patch.py?id=31164
Old revision New revision Changes Path 1.21 1.22 +32 -2 appdb/include/appData.php 1.16 1.17 +21 -2 appdb/include/downloadurl.php 1.11 1.12 +8 -1 appdb/include/version_queue.php 1.32 1.33 +1 -1 appdb/tables/appdb_tables.sql
Index: appdb/include/appData.php diff -u -p appdb/include/appData.php:1.21 appdb/include/appData.php:1.22 --- appdb/include/appData.php:1.21 9 Jun 2007 15:44:46 -0000 +++ appdb/include/appData.php 9 Jun 2007 15:44:46 -0000 @@ -52,6 +52,34 @@ class appData return $hResult; }
+ function reQueue() + { + if(!$this->canEdit()) + return FALSE; + + $sQuery = "UPDATE appData SET queued = '?' WHERE id = '?'"; + $hResult = query_parameters($sQuery, "true", $this->iId); + + if(!$hResult) + return FALSE; + else + return TRUE; + } + + function reject() + { + if(!$this->canEdit()) + return FALSE; + + $sQuery = "UPDATE appData SET queued = '?' WHERE id = '?'"; + $hResult = query_parameters($sQuery, "rejected", $this->iId); + + if(!$hResult) + return FALSE; + else + return TRUE; + } + function update($bSilent = FALSE) { if(!$this->canEdit()) @@ -122,7 +150,7 @@ class appData }
/* Get appData for a given version/application, optionally filter by type */ - function getData($iId, $sType, $bIsVersion = TRUE, $bQueued = FALSE) + function getData($iId, $sType, $bIsVersion = TRUE, $bQueued = FALSE, $bRejected = FALSE) { $iAppId = 0; $iVersionId = 0; @@ -132,9 +160,11 @@ class appData else $iAppId = $iId;
+ $sQueued = objectManager::getQueueString($bQueued, $bRejected); + $hResult = query_parameters("SELECT * FROM appData WHERE appId = '?' AND versionId = '?' AND TYPE = '?' AND queued = '?'", - $iAppId, $iVersionId, $sType, $bQueued ? "true" : "false"); + $iAppId, $iVersionId, $sType, $sQueued);
if(!$hResult || !mysql_num_rows($hResult)) return FALSE; Index: appdb/include/downloadurl.php diff -u -p appdb/include/downloadurl.php:1.16 appdb/include/downloadurl.php:1.17 --- appdb/include/downloadurl.php:1.16 9 Jun 2007 15:44:46 -0000 +++ appdb/include/downloadurl.php 9 Jun 2007 15:44:46 -0000 @@ -244,8 +244,13 @@ class downloadurl $sDownloadUrlDescription = $aValues["sDownloadUrlDescription"]; } else if($iVersionId) { - if($hResult = appData::getData($iVersionId, "downloadurl", - TRUE, TRUE)) + /* This illustrates the importance of converting downloadurl completely + to the objectManager model. If we don't get a match searching for + a queued entry, try finding a rejected one. */ + if(($hResult = appData::getData($iVersionId, "downloadurl", + TRUE, TRUE, FALSE)) || + $hResult = appData::getData($iVersionId, "downloadurl", + TRUE, TRUE, TRUE)) { $oRow = mysql_fetch_object($hResult); $sDownloadUrlUrl = $oRow->url; @@ -370,6 +375,20 @@ class downloadurl return TRUE; }
+ function reQueue() + { + $oAppData = new AppData($this->iId); + + return $oAppData->reQueue(); + } + + function reject() + { + $oAppData = new AppData($this->iId); + + return $oAppData->reject(); + } + function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0) { return appData::objectGetEntries($bQueued, $bRejected, $iRows, $iStart, Index: appdb/include/version_queue.php diff -u -p appdb/include/version_queue.php:1.11 appdb/include/version_queue.php:1.12 --- appdb/include/version_queue.php:1.11 9 Jun 2007 15:44:46 -0000 +++ appdb/include/version_queue.php 9 Jun 2007 15:44:46 -0000 @@ -16,7 +16,13 @@ class version_queue { $iTestingId = testData::getNewestTestIdFromVersionId($iVersionId, $this->oVersion->sQueued); - if($hResult = appData::getData($iVersionId, "downloadurl", TRUE, TRUE)) + /* This illustrates the importance of converting downloadurl completely + to the objectManager model. If we don't get a match searching for + a queued entry, try finding a rejected one. */ + if(($hResult = appData::getData($iVersionId, "downloadurl", + TRUE, TRUE, FALSE)) || + $hResult = appData::getData($iVersionId, "downloadurl", + TRUE, TRUE, TRUE)) { if($oRow = mysql_fetch_object($hResult)) $iDownloadUrlId = $oRow->id; @@ -46,6 +52,7 @@ class version_queue { $this->oVersion->reQueue(); $this->oTestDataQueue->reQueue(); + $this->oDownloadUrl->reQueue(); }
function reject() Index: appdb/tables/appdb_tables.sql diff -u -p appdb/tables/appdb_tables.sql:1.32 appdb/tables/appdb_tables.sql:1.33 --- appdb/tables/appdb_tables.sql:1.32 9 Jun 2007 15:44:46 -0000 +++ appdb/tables/appdb_tables.sql 9 Jun 2007 15:44:46 -0000 @@ -140,7 +140,7 @@ create table appData ( url varchar(255) default NULL, submitTime timestamp(14) NOT NULL, submitterId int(11) NOT NULL default '0', - queued enum('true','false') NOT NULL default 'false', + queued enum('true','false','rejected') NOT NULL default 'false', KEY id (id), KEY versionId (versionId) );