PDA

View Full Version : Attachment Stats


mikesafl
04-12-2013, 10:53 PM
Vbulletin 4.2.0 L3
As im sure some of you know there is attachment stats in the admin panel, What im trying to do is create a sideblock that shows how many attachments are on the site, and how many downloads of those attachments there are. Im sure there is some sort of code to put somewhere. Can anyone help with this? Thanks in advance

Edit*
Im trying to get attachment stats from admincp
Unique / Total Attachments 83,938
Total Downloads 3,840,776

To show up like this guy did in this mod https://vborg.vbsupport.ru/showthread.php?t=236403&highlight=attachment+stats&page=2


This is what i have found and tried so far but it gives me database error.
//attachment count
// Total Attachments
$total_attach = $db->query_first('
SELECT count(*) AS count
FROM ' . TABLE_PREFIX . 'attachment
');
$newattachments = number_format($total_attach ['count']);
// ### Total Attachments ##

//Total Space Used
$total_hits2 = $db->query_first("
SELECT SUM(filesize) AS size
FROM " . TABLE_PREFIX . "attachment
");
$total_hits2_in_mb =@substr($total_hits2['size']/1048576,0,4);
//Total Space Used

//Total Downloads
$total_downloads = $db->query_first('
SELECT COUNT(*),
SUM(counter) AS download
FROM ' . TABLE_PREFIX . 'attachment
');
$total_downloads = number_format($total_downloads['download']);
//Total Downloads]]>