From 7fe9ad5c770b4eb86cdbd3483320228cf1e4b4e7 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 28 Oct 2024 11:00:24 -0600 Subject: [PATCH] Fix page load time for call_recordings The page load time was slow when there were no call recordings for the domain. Remove domain_uuid is null as this isn't needed for call recordings. --- app/call_recordings/call_recordings.php | 29 +++++-------------------- 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/app/call_recordings/call_recordings.php b/app/call_recordings/call_recordings.php index c3d4be0889..8250c220f1 100644 --- a/app/call_recordings/call_recordings.php +++ b/app/call_recordings/call_recordings.php @@ -38,6 +38,9 @@ exit; } +//create the database connection + $database = new database; + //add multi-lingual support $language = new text; $text = $language->get(); @@ -104,24 +107,6 @@ } $parameters['time_zone'] = $time_zone; -//get the count - //$sql = "select count(*) "; - //$sql .= "from view_call_recordings "; - //$sql .= "where true "; - //if ($_GET['show'] != "all" || !permission_exists('call_recording_all')) { - // $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; - // $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - //} - //if (isset($search)) { - // $sql .= "and ("; - // $sql .= " lower(call_recording_name) like :search "; - // $sql .= " or lower(call_recording_path) like :search "; - // $sql .= ") "; - // $parameters['search'] = '%'.$search.'%'; - //} - //$database = new database; - //$num_rows = $database->select($sql, $parameters, 'column'); - //prepare some of the paging values $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; $page = $_GET['page'] ?? ''; @@ -138,7 +123,7 @@ //$sql .= "from v_call_recordings as r, v_domains as d "; $sql .= "where true "; if ($show != "all" || !permission_exists('call_recording_all')) { - $sql .= "and (r.domain_uuid = :domain_uuid or r.domain_uuid is null) "; + $sql .= "and r.domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; } $sql .= "and r.domain_uuid = d.domain_uuid "; @@ -156,7 +141,6 @@ } $sql .= order_by($order_by, $order, 'r.call_recording_date', 'desc'); $sql .= limit_offset($rows_per_page, $offset); - $database = new database; $call_recordings = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); @@ -168,9 +152,6 @@ } } -//count the results - $result_count = is_array($call_recordings) ? sizeof($call_recordings) : 0; - //limit the number of results if (!empty($_SESSION['cdr']['limit']['numeric']) && $_SESSION['cdr']['limit']['numeric'] > 0) { $num_rows = $_SESSION['cdr']['limit']['numeric']; @@ -194,7 +175,7 @@ //show the content echo "
\n"; - echo "
".$text['title-call_recordings']."
".number_format($result_count)."
\n"; + echo "
".$text['title-call_recordings']."
\n"; echo "
\n"; if (permission_exists('call_recording_download') && !empty($call_recordings)) { echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'id'=>'btn_download','name'=>'btn_download','style'=>'display: none;','collapse'=>'hide-xs','onclick'=>"list_action_set('download'); list_form_submit('form_list');"]);