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;
|
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
|
||||||
|
AND
|
||||||
|
(
|
||||||
|
(
|
||||||
|
appFamily.appId = appMaintainers.appId
|
||||||
|
AND
|
||||||
|
appFamily.queued = 'false'
|
||||||
|
AND
|
||||||
|
appMaintainers.versionId = ''
|
||||||
|
)
|
||||||
|
OR
|
||||||
|
(
|
||||||
appVersion.versionId = appMaintainers.versionId
|
appVersion.versionId = appMaintainers.versionId
|
||||||
AND appVersion.queued = 'false'))";
|
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);
|
||||||
|
|||||||
@@ -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().")",
|
||||||
|
|||||||
Reference in New Issue
Block a user