vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Administrative and Maintenance Tools - AdminCP Quick Stats Improvement (https://vborg.vbsupport.ru/showthread.php?t=319349)

Falcon Capt 07-04-2015 09:00 PM

AdminCP Quick Stats Improvement
 
1 Attachment(s)
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!

Manoel J?nior 07-08-2015 12:53 AM

Love this. Please plugin this.

Alan_SP 07-08-2015 06:08 PM

It can't be done. It requires editing files.

Plugins can do some useful staff, but can't touch files.

Darkman7030 07-17-2015 09:09 PM

1 Attachment(s)
Can you help me vb 4.2.0?

Falcon Capt 07-17-2015 09:36 PM

Quote:

Originally Posted by Darkman7030 (Post 2550535)
Can you help me vb 4.2.0?

Looks like you may have forgetten to add this part:


Code:

*************************************


FIND IN LINE 817:



// ##### 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'

");




And place this directly after:


// ##### 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));


**************************************






and this:


Code:

*************************************

FIND near Line 910:

print_table_footer();

($hook = vBulletinHook::fetch_hook('admin_index_main1')) ? eval($hook) : false;


REPLACE WITH:


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;


*************************************


Darkman7030 07-17-2015 09:47 PM

1 Attachment(s)
Yes done everything exactly
here is my index.php have tried everything without success

Falcon Capt 07-17-2015 10:06 PM

Try this one, it is the full AdminCP index.php file minus the header and footer, just cut and paste it into yours and see if it works.

Let me know!

Darkman7030 07-17-2015 10:28 PM

Unfortunately it did not work :(

Falcon Capt 07-17-2015 10:33 PM

Quote:

Originally Posted by Darkman7030 (Post 2550545)
Unfortunately it did not work :(

Must be something with 4.2.0, if you upgrade to 4.2.2 or 4.2.3 it'll work.

Darkman7030 07-23-2015 06:29 AM

Quote:

Originally Posted by Falcon Capt (Post 2550546)
Must be something with 4.2.0, if you upgrade to 4.2.2 or 4.2.3 it'll work.


so have now update made to 4.2.3
but still it does not work still same error :(

Falcon Capt 07-23-2015 01:24 PM

Quote:

Originally Posted by Darkman7030 (Post 2551132)
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.

Darkman7030 07-23-2015 03:19 PM

No have Dedicated Server ;) and debian wheezy

Falcon Capt 07-23-2015 09:19 PM

1 Attachment(s)
Quote:

Originally Posted by Darkman7030 (Post 2551162)
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! :o

Falcon Capt 07-26-2015 02:47 PM

Quote:

Originally Posted by Darkman7030 (Post 2551162)
No have Dedicated Server ;) and debian wheezy

Did that file fix it?

Zachery 07-27-2015 01:45 AM

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./

Falcon Capt 07-27-2015 02:17 AM

Quote:

Originally Posted by Zachery (Post 2551438)
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)...

Zachery 07-27-2015 02:32 AM

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

Your function si_mysqlistats() , you can just use the vBulletin db info, which is already available to you.

Falcon Capt 07-27-2015 02:46 AM

Quote:

Originally Posted by Zachery (Post 2551445)
Yes, because what works for you obviously works for everyone. :rolleyes:

Wow...

Quote:

Originally Posted by Zachery (Post 2551445)
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...


All times are GMT. The time now is 07:32 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01525 seconds
  • Memory Usage 1,810KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (14)bbcode_code_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (18)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete