Authors: Alexander Nicolaysen Sørnes <alex@thehandofagony.com>, Chris Morgan <cmorgan@alum.wpi.edu>

Fix queued maintainer sql with missing join causing millions of rows to be generated by a
relatively simple sql statement
This commit is contained in:
WineHQ
2007-03-11 20:39:02 +00:00
parent 9bba0ecd65
commit 43ac9708ca
2 changed files with 24 additions and 10 deletions

View File

@@ -270,19 +270,33 @@ class maintainer
return $aAppsMaintained; return $aAppsMaintained;
} }
function getQueuedMaintainerCount() function objectGetEntriesCount($bQueued)
{ {
/* Excluding requests for queued apps and versions, as these are handled /* Excluding requests for queued apps and versions, as these are handled
automatically. One SELECT for super maintainers, one for maintainers. */ automatically. One SELECT for super maintainers, one for maintainers. */
$sQuery = "SELECT COUNT(DISTINCT maintainerId) as queued_maintainers FROM $sQuery = "SELECT COUNT(DISTINCT maintainerId) as queued_maintainers FROM
appMaintainers, appFamily, appVersion appMaintainers, appFamily, appVersion WHERE
WHERE appMaintainers.queued='true' AND ((appFamily.appId = appMaintainers.queued = '?'
appMaintainers.appId AND appFamily.queued = 'false' AND AND
appMaintainers.versionId = '') OR ( appFamily.appId = appVersion.appId
appVersion.versionId = appMaintainers.versionId AND
AND appVersion.queued = 'false'))"; (
(
appFamily.appId = appMaintainers.appId
AND
appFamily.queued = 'false'
AND
appMaintainers.versionId = ''
)
OR
(
appVersion.versionId = appMaintainers.versionId
AND
appVersion.queued = 'false'
)
)";
if(!($hResult = query_parameters($sQuery))) if(!($hResult = query_parameters($sQuery, $bQueued ? "true" : "false")))
return FALSE; return FALSE;
$oRow = mysql_fetch_object($hResult); $oRow = mysql_fetch_object($hResult);

View File

@@ -21,7 +21,7 @@ function global_admin_menu() {
"screenshot").")", "screenshot").")",
BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=". BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=".
"Screenshot%20Queue"); "Screenshot%20Queue");
$g->add("View Maintainer Queue (".Maintainer::getQueuedMaintainerCount().")", $g->add("View Maintainer Queue (".Maintainer::objectGetEntriesCount(true).")",
BASE."objectManager.php?sClass=maintainer&bIsQueue=true&sTitle=". BASE."objectManager.php?sClass=maintainer&bIsQueue=true&sTitle=".
"Maintainer%20Queue"); "Maintainer%20Queue");
$g->add("View Maintainer Entries (".Maintainer::getMaintainerCount().")", $g->add("View Maintainer Entries (".Maintainer::getMaintainerCount().")",