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);
|
||||
|
||||
@@ -21,7 +21,7 @@ function global_admin_menu() {
|
||||
"screenshot").")",
|
||||
BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=".
|
||||
"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=".
|
||||
"Maintainer%20Queue");
|
||||
$g->add("View Maintainer Entries (".Maintainer::getMaintainerCount().")",
|
||||
|
||||
Reference in New Issue
Block a user