Fix "total_count" type on some WS methods

This commit is contained in:
mistic100 2024-08-30 19:23:15 +02:00 committed by Pierrick Le Gall
parent 8fc3c9cd0e
commit 3f07808d7f
3 changed files with 8 additions and 4 deletions

View file

@ -137,6 +137,7 @@ SELECT SQL_CALC_FOUND_ROWS i.*
}
list($total_images) = pwg_db_fetch_row(pwg_query('SELECT FOUND_ROWS()'));
$total_images = (int)$total_images;
// let's take care of adding the related albums to each photo
if (count($image_ids) > 0)

View file

@ -243,6 +243,7 @@ SELECT DISTINCT ';
if (isset($params['display']['total_count'])) {
$total_count_query_result = pwg_query('SELECT FOUND_ROWS();');
list($total_count) = pwg_db_fetch_row($total_count_query_result);
$total_count = (int)$total_count;
}
while ($row = pwg_db_fetch_assoc($result))
{
@ -351,12 +352,14 @@ SELECT DISTINCT ';
array(
'page' => $params['page'],
'per_page' => $params['per_page'],
'count' => count($users)
'count' => count($users),
'total_count' => $total_count,
)
),
'users' => new PwgNamedArray(array_values($users), 'user')
);
}
// deprecated: kept for retrocompatibility
if (isset($params['display']['total_count'])) {
$method_result['total_count'] = $total_count;
}