Jump to content
vBWarez - Rest In Peace

AdminCP Quick Stats Improvement


Recommended Posts

Improved AdminCP Quick Stats:

In admincp/index.php

CHANGE LINE 21 FROM:


[CODE]$specialtemplates = array('maxloggedin', 'acpstats');
TO:[/CODE]


[CODE]$specialtemplates = array('maxloggedin');[/CODE]



CHANGE LINE 177-179 FROM: (adds "New Window" link at top of AdminCP)


[CODE] <a href="<?php echo $forumhomelink; ?>" target="_blank"><?php echo $vbphrase['forum_home_page']; ?></a>
|
<a href="index.php?<?php echo $vbulletin->session->vars['sessionurl']; ?>do=cplogout" onclick="return confirm('<?php echo $vbphrase['sure_you_want_to_log_out_of_cp']; ?>');" target="_top"><?php echo $vbphrase['log_out']; ?></a>
</td>[/CODE]

TO:


[CODE] <a href="../<?php echo $vbulletin->options['forumhome']; ?>.php<?php echo $vbulletin->session->vars['sessionurl_q']; ?>" ><?php echo $vbphrase['forum_home_page']; ?></a>
|
<a href="../<?php echo $vbulletin->options['forumhome']; ?>.php<?php echo $vbulletin->session->vars['sessionurl_q']; ?>" target="_blank">Forum Home (new window)</a>
|
<a href="index.php?<?php echo $vbulletin->session->vars['sessionurl']; ?>do=cplogout" onclick="return confirm('<?php echo $vbphrase['sure_you_want_to_log_out_of_cp']; ?>');" target="_top"><?php echo $vbphrase['log_out']; ?></a>
</td>[/CODE]

FIND THIS STARTING AT LINE 817:


[CODE]// ##### Messages to Moderate
$messagecount = $db->query_first("
SELECT COUNT(*) AS count
FROM " . TABLE_PREFIX . "moderation AS moderation
INNER JOIN " . TABLE_PREFIX . "visitormessage AS visitormessage ON (visitormessage.vmid = moderation.primaryid)
WHERE moderation.type = 'visitormessage'
");

$mailqueue = $vbulletin->db->query_first("
SELECT COUNT(mailqueueid) AS queued FROM " . TABLE_PREFIX . "mailqueue
");[/CODE]

REPLACE WITH THIS:


[CODE]// ##### Messages to Moderate
$messagecount = $db->query_first("
SELECT COUNT(*) AS count
FROM " . TABLE_PREFIX . "moderation AS moderation
INNER JOIN " . TABLE_PREFIX . "visitormessage AS visitormessage ON (visitormessage.vmid = moderation.primaryid)
WHERE moderation.type = 'visitormessage'
");

// ##### Server Load
if ($_REQUEST['show'] == 'serverload' || empty($_REQUEST['show'])) {
$loadavg = @file_get_contents("/proc/loadavg");
$method = '';
if ($loadavg) {
$regs = explode(" ",$loadavg);
$serverload='Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2];
$method = 'file_get_contents("/proc/loadavg")';
} elseif ( $stats = @exec('uptime') ) {
preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
$serverload = '<b>Server Load:</b> ' . $regs[0] .' <font size="1">(1 min, 5 min, 15 min)</font>';
$method = 'exec(uptime)';
} else {
$serverload = 'failed';
}


};

// ##### Users Online
$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
$guestsarry = $db->query_first("SELECT COUNT(host) AS sessions FROM " . TABLE_PREFIX . "session WHERE userid = 0 AND lastactivity > $datecut");
$membersarry = $db->query_read("SELECT DISTINCT userid FROM " . TABLE_PREFIX . "session WHERE userid <> 0 AND lastactivity > $datecut");
$guests = intval($guestsarry['sessions']);
$members = intval($db->num_rows($membersarry));

$mailqueue = $vbulletin->db->query_first("
SELECT COUNT(mailqueueid) AS queued FROM " . TABLE_PREFIX . "mailqueue
");[/CODE]


FIND IN LINE 868: (reorganizes stats and adds additional stats)


[CODE] print_cells_row(array(
$vbphrase['mysql_max_packet_size'], vb_number_format($maxpacket, 2, 1),
$vbphrase['new_posts_today'], vb_number_format($vbulletin->acpstats['newposts']),
$vbphrase['queued_emails'], vb_number_format($mailqueue['queued'])
), 0, 0, -5, 'top', 1, 1);
}
else
{[/CODE]

REPLACE WITH:


[CODE]
print_cells_row(array(
$vbphrase['mysql_max_packet_size'], vb_number_format($maxpacket, 2, 1),
$vbphrase['users_online'], construct_phrase($vbphrase['x_y_members_z_guests'], vb_number_format($guests + $members), vb_number_format($members), vb_number_format($guests)),
$vbphrase['new_posts_today'], vb_number_format($vbulletin->acpstats['newposts'])
), 0, 0, -5, 'top', 1, 1);
print_cells_row(array(
'vBulletin Software Version', $vbulletin->options['templateversion'],
'Server Load (1 min, 5 min, 15 min)', $loadavg = '' . $regs[1] .' | '. $regs[2] .' | '. $regs[3] .'',
$vbphrase['queued_emails'], vb_number_format($mailqueue['queued'])
), 0, 0, -5, 'top', 1, 1);
}
else
{[/CODE]


FIND IN LINE 910/911: (Adds Memory Usage data block)


[CODE]print_table_footer();
($hook = vBulletinHook::fetch_hook('admin_index_main1')) ? eval($hook) : false;

REPLACE WITH:[/CODE]



[CODE]print_table_footer();
if ($_REQUEST['show'] == 'memoryusage' || empty($_REQUEST['show'])) {
print_form_header('', '');
exec('free -m', $mem);
print_table_header('Memory Usage');print_description_row('<pre>'.implode('<br />', $mem).'</pre>');
print_table_footer();
}
($hook = vBulletinHook::fetch_hook('admin_index_main1')) ? eval($hook) : false;[/CODE]


FIND IN LINE 1020:


[CODE] 'http://www.vbulletin.com/docs/html/' => $vbphrase['reference_manual'][/CODE]

PLACE THIS DIRECTLY BELOW IT: (Adds vbulletin.org in the quick links)



[CODE] 'http://www.vbulletin.org/' => 'vBulletin.org'[/CODE]

Add the attached file (server_info.php) to your AdminCP folder. (Edit line 116 to include your database information: "localhost", "dbuser", "dbpassword", "dbname")

See attached images for the enhancements.

Enjoy!

SERVER_INFO.PHP
[ATTACH]10374[/ATTACH]

SCREENSHOTS

Link to post
Share on other sites
×
×
  • Create New...