Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
AdminCP Quick Stats Improvement Details »»
AdminCP Quick Stats Improvement
Version: 1.00, by Falcon Capt Falcon Capt is offline
Developer Last Online: Jun 2023 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 4.2.2 Rating:
Released: 07-04-2015 Last Update: 07-23-2015 Installs: 8
Code Changes  
No support by the author.

Improved AdminCP Quick Stats:

In admincp/index.php

CHANGE LINE 21 FROM:

Code:
$specialtemplates = array('maxloggedin', 'acpstats');
TO:

Code:
$specialtemplates = array('maxloggedin');



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>

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>

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
");

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
");


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
{

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
{


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:
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;


FIND IN LINE 1020:

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

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


Code:
				'http://www.vbulletin.org/' => 'vBulletin.org'

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!

Download Now

File Type: php server_info.php (5.0 KB, 23 views)

Screenshots

File Type: jpg AdminCP_new_window_link.jpg (11.5 KB, 0 views)
File Type: jpg AdminCP_quick_stats.jpg (106.7 KB, 0 views)
File Type: jpg AdminCP_useful_links.jpg (55.4 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 07-23-2015, 01:24 PM
Falcon Capt Falcon Capt is offline
 
Join Date: May 2006
Location: U.S.
Posts: 123
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Darkman7030 View Post
so have now update made to 4.2.3
but still it does not work still same error
Are you on shared hosting? I don't think you'll be able to get server load and memory information if you are on basic shared hosting.
Reply With Quote
  #13  
Old 07-23-2015, 03:19 PM
Darkman7030 Darkman7030 is offline
 
Join Date: Nov 2014
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No have Dedicated Server and debian wheezy
Reply With Quote
  #14  
Old 07-23-2015, 09:19 PM
Falcon Capt Falcon Capt is offline
 
Join Date: May 2006
Location: U.S.
Posts: 123
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Darkman7030 View Post
No have Dedicated Server and debian wheezy
Add the attached file to your AdminCP folder.

(Edit line 116 to include your database information: "localhost", "dbuser", "dbpassword", "dbname")

Sorry about that!
Attached Files
File Type: php server_info.php (5.0 KB, 11 views)
Reply With Quote
  #15  
Old 07-26-2015, 02:47 PM
Falcon Capt Falcon Capt is offline
 
Join Date: May 2006
Location: U.S.
Posts: 123
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Darkman7030 View Post
No have Dedicated Server and debian wheezy
Did that file fix it?
Reply With Quote
  #16  
Old 07-27-2015, 01:45 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm confused, why do you need to edit another file to get the server details? You can just use the config.php data, you're already in the vBulletin scope.

additionally, this seems like a bad idea to uncache the AdminCP stats, they're already kind of intensive./
Reply With Quote
  #17  
Old 07-27-2015, 02:17 AM
Falcon Capt Falcon Capt is offline
 
Join Date: May 2006
Location: U.S.
Posts: 123
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery View Post
I'm confused, why do you need to edit another file to get the server details? You can just use the config.php data, you're already in the vBulletin scope.

additionally, this seems like a bad idea to uncache the AdminCP stats, they're already kind of intensive./
His stats weren't resolving, I had that server_info file on mine, I think that may have been a carry-over from a mod I added years ago...

Uncaching the AdminCP stats works fine, I've had it that way for years and my server loads are just fine (typically under 0.50 on a very busy forum)...
Reply With Quote
  #18  
Old 07-27-2015, 02:32 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, because what works for you obviously works for everyone.

Your function si_mysqlistats() , you can just use the vBulletin db info, which is already available to you.
Reply With Quote
  #19  
Old 07-27-2015, 02:46 AM
Falcon Capt Falcon Capt is offline
 
Join Date: May 2006
Location: U.S.
Posts: 123
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery View Post
Yes, because what works for you obviously works for everyone.
Wow...

Quote:
Originally Posted by Zachery View Post
Your function si_mysqlistats() , you can just use the vBulletin db info, which is already available to you.
No one says you (or anyone) has to use this, it is something I use and that I find helpful that I thought I would share for others who would like to use it... Sorry, I'm not some super-duper coder/programmer, just using what I got to work... Sorry it apparently doesn't meet with your approval...
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:55 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05166 seconds
  • Memory Usage 2,341KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (12)bbcode_code
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (5)postbit_attachment
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete