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:
@@ -270,19 +270,33 @@ class maintainer
|
||||
return $aAppsMaintained;
|
||||
}
|
||||
|
||||
function getQueuedMaintainerCount()
|
||||
function objectGetEntriesCount($bQueued)
|
||||
{
|
||||
/* Excluding requests for queued apps and versions, as these are handled
|
||||
automatically. One SELECT for super maintainers, one for maintainers. */
|
||||
$sQuery = "SELECT COUNT(DISTINCT maintainerId) as queued_maintainers FROM
|
||||
appMaintainers, appFamily, appVersion
|
||||
WHERE appMaintainers.queued='true' AND ((appFamily.appId =
|
||||
appMaintainers.appId AND appFamily.queued = 'false' AND
|
||||
appMaintainers.versionId = '') OR (
|
||||
appVersion.versionId = appMaintainers.versionId
|
||||
AND appVersion.queued = 'false'))";
|
||||
$sQuery = "SELECT COUNT(DISTINCT maintainerId) as queued_maintainers FROM
|
||||
appMaintainers, appFamily, appVersion WHERE
|
||||
appMaintainers.queued = '?'
|
||||
AND
|
||||
appFamily.appId = appVersion.appId
|
||||
AND
|
||||
(
|
||||
(
|
||||
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;
|
||||
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
|
||||
Reference in New Issue
Block a user