Use DBA::fetchFirst instead of DBA::p for aggregate query in Module\Admin\Federation

This commit is contained in:
Hypolite Petovan 2019-04-28 09:48:26 -04:00
parent 451a06a597
commit 2a035b9b2f

View file

@ -43,7 +43,7 @@ class Federation extends BaseAdminModule
foreach ($platforms as $platform) { foreach ($platforms as $platform) {
// get a total count for the platform, the name and version of the // get a total count for the platform, the name and version of the
// highest version and the protocol tpe // highest version and the protocol tpe
$platformCountStmt = DBA::p('SELECT $platformCount = DBA::fetchFirst('SELECT
COUNT(*) AS `total`, COUNT(*) AS `total`,
SUM(`registered-users`) AS `users`, SUM(`registered-users`) AS `users`,
ANY_VALUE(`platform`) AS `platform`, ANY_VALUE(`platform`) AS `platform`,
@ -52,12 +52,9 @@ class Federation extends BaseAdminModule
WHERE `platform` LIKE ? WHERE `platform` LIKE ?
AND `last_contact` >= `last_failure` AND `last_contact` >= `last_failure`
ORDER BY `version` ASC', $platform); ORDER BY `version` ASC', $platform);
$platformCount = DBA::fetch($platformCountStmt);
$total += $platformCount['total']; $total += $platformCount['total'];
$users += $platformCount['users']; $users += $platformCount['users'];
DBA::close($platformCountStmt);
// what versions for that platform do we know at all? // what versions for that platform do we know at all?
// again only the active nodes // again only the active nodes
$versionCountsStmt = DBA::p('SELECT $versionCountsStmt = DBA::p('SELECT