diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2012-10-28 08:45:33 +0100 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2015-11-08 14:27:58 +0100 |
commit | 91647e8e3e810f4b284eee52d752620d8396a29c (patch) | |
tree | 935336a8ee37b3a2c98f81fbbc626697dd643e15 | |
parent | d79af709c1f99c84a1b3cb983fb2af7b4e49015f (diff) |
Make stats page faster!
-rw-r--r-- | stats.php | 72 |
1 files changed, 1 insertions, 71 deletions
@@ -59,69 +59,6 @@ $total_raids = $db->query_first('SELECT count(*) FROM ' . RAIDS_TABLE); $total_drops = $db->query_first('SELECT count(i.item_id) AS total_drops FROM ' . ITEMS_TABLE . ' i WHERE (i.item_value !=0.00)'); $show_all = ( (!empty($_GET['show'])) && ($_GET['show'] == "all") ) ? true : false; - -$sql = 'CREATE TEMPORARY TABLE R90 - SELECT ra.member_name, count(ra.raid_id) AS raid_count_90 - FROM - ' . RAID_ATTENDEES_TABLE . ' ra, - ' . RAIDS_TABLE . ' r - WHERE - (r.raid_id = ra.raid_id) - AND (r.raid_date >= ' . $ninety_days . ') - GROUP BY - ra.member_name;'; - -if ( !($members_result = $db->query($sql)) ) -{ - message_die('Could not create R90 table', '', __FILE__, __LINE__, $sql); -} - -$sql = 'CREATE TEMPORARY TABLE R60 - SELECT ra.member_name, count(ra.raid_id) AS raid_count_60 - FROM - ' . RAID_ATTENDEES_TABLE . ' ra, - ' . RAIDS_TABLE . ' r - WHERE - (r.raid_id = ra.raid_id) - AND (r.raid_date >= ' . $sixty_days . ') - GROUP BY - ra.member_name;'; - -if ( !($members_result = $db->query($sql)) ) -{ - message_die('Could not create R60 table', '', __FILE__, __LINE__, $sql); -} - -$sql = 'CREATE TEMPORARY TABLE R30 - SELECT ra.member_name, count(ra.raid_id) AS raid_count_30 - FROM - ' . RAID_ATTENDEES_TABLE . ' ra, - ' . RAIDS_TABLE . ' r - WHERE - (r.raid_id = ra.raid_id) - AND (r.raid_date >= ' . $thirty_days . ') - GROUP BY - ra.member_name;'; - -if ( !($members_result = $db->query($sql)) ) -{ - message_die('Could not create R30 table', '', __FILE__, __LINE__, $sql); -} - -$sql = 'CREATE TEMPORARY TABLE DROPS - SELECT m.member_name, count(i.item_id) AS member_drops - FROM eqdkp_members AS m - LEFT JOIN eqdkp_member_ranks AS mr - ON m.member_rank_id=mr.rank_id - LEFT JOIN eqdkp_items AS i - ON m.member_name = i.item_buyer - GROUP BY m.member_name;'; - -if ( !($members_result = $db->query($sql)) ) -{ - message_die('Could not create DROPS table', '', __FILE__, __LINE__, $sql); -} - // No idea if this massive query will work outside MySQL...if not, we'll have to use a switch and get the values another way $sql = 'SELECT @@ -238,13 +175,6 @@ else $footcount_text = sprintf($user->lang['stats_footcount'], $db->num_rows($members_result)); } -// Drop the temporary tables. Probably unnecessary, but it can't hurt. -$sql = 'DROP TEMPORARY TABLE R30, R60, R90, DROPS;'; -if ( !($members_result = $db->query($sql)) ) -{ - message_die('Could not drop temporary tables', '', __FILE__, __LINE__, $sql); -} - // Class Statistics // Class Summary // Classes array - if an element is false, that class has gotten no @@ -466,4 +396,4 @@ $eqdkp->set_vars(array( 'template_file' => 'stats.html', 'display' => true) ); -?>
\ No newline at end of file +?> |