From 46f042df5d722f0bdc3dbaa9c067006fecd5ca7d Mon Sep 17 00:00:00 2001 From: ozhozh Date: Thu, 3 Sep 2009 21:58:54 +0000 Subject: [PATCH] 1 less query in /admin/index.php git-svn-id: http://yourls.googlecode.com/svn/trunk@114 12232710-3e20-11de-b438-597f59cd7555 --- admin/index.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/admin/index.php b/admin/index.php index 785b96d..c4208b6 100644 --- a/admin/index.php +++ b/admin/index.php @@ -87,8 +87,12 @@ } // Get URLs Count for current filter, total links in DB & total clicks -$total_items = $ydb->get_var("SELECT COUNT(keyword) FROM $table_url WHERE 1=1 $where"); -$totals = $ydb->get_row("SELECT COUNT(keyword) as c, SUM(clicks) as s FROM $table_url WHERE 1=1"); +list( $total_urls, $total_clicks ) = array_values( yourls_get_db_stats() ); +if ( $where ) { + list( $total_items, $total_items_clicks ) = array_values( yourls_get_db_stats( $where ) ); +} else { + $total_items = $total_urls; +} // This is a bookmarklet if ( isset( $_GET['u'] ) ) { @@ -162,7 +166,7 @@ Display to of URLs. - Overall, tracking c); ?> links, s); ?> clicks, and counting! + Overall, tracking links, clicks, and counting!

-- 2.45.0