vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Admin Quick Stats (https://vborg.vbsupport.ru/showthread.php?t=37193)

FWC 04-11-2002 06:23 AM

Cool. I'm glad it worked. It's a great hack!

ryanhulce 04-11-2002 06:26 AM

Here is what Opera Showed!

inphinity 04-11-2002 11:43 AM

nice hack freddy :)

on my board i've found that it slows the loading of the admin page by a few seconds and also adds to the load of the machine.

so i've moved it to a seperate file and added a link to my admin nav bar :)

Save Freddys hack to admin/adminquickstats.php at the top of the file add:
PHP Code:

<?php

error_reporting
(7);

require(
"./global.php");

cpheader();

and the bottom of the file add
PHP Code:

cpfooter();

?> 

In admin/index.php find
PHP Code:

makenavoption("Back-up Database","backup.php?action=choose","<br>"); 

above it add
PHP Code:

makenavoption("Database Stats","adminquickstats.php?action=","<br>"); 


Freddie Bingham 04-11-2002 01:22 PM

Yes it will do a full scan of the post/thread/user tables so it can appear slow. I don't see any long term effects on load happening though unless you are reloading the Admin CP index often.

Harvey 04-11-2002 03:25 PM

Hi,

I don't reccoment if you don't call admin/index.php every few seconds, but if you want to try at your own risk, query some SQL-commands:

create index joindate on user (joindate)
create index dateline on thread (dateline)
create index dateline on post (dateline)
create index lastactivity on user (lastactivity)

If you don't get what you want, you can undo with:

alter table user drop index joindate
alter table thread drop index dateline
alter table post drop index dateline
alter table user drop index lastactivity

Freddie Bingham 04-11-2002 03:34 PM

Don't add those indeces to your forum as it will result in a general slowdown.

It will make these stats appear instantly but you will then have dateline indexed twice in thread and post since it is part of a multi-record index already. You will then have lastactivity indexed on the user table which will then have to be updated on every pageview which can be a bad thing.

It is important to devote optimization to the user side of the forum at the admin panel's cost.

Harvey 04-11-2002 04:43 PM

huh - did I miss something in the upgrades? I can't find any indices of dateline (checked with show create table post / thread)

But you're right, it would slow down update/insert/delete-statements.

Freddie Bingham 04-11-2002 05:59 PM

Your right. I am getting confused with vb3 tables I think. Just ignore me. I still woudn't put that index on the user.lastactivity though.

Martz 04-12-2002 07:22 AM

Excellent, works well apart from the slow admin/index.php - but that I can handle.

Austin Dea 04-13-2002 05:07 PM

Works bootyfully :D.

Harvey 04-13-2002 06:19 PM

works greate on 2.2.4 without modification (no surprise). I installed. Without index. PHP is 412, so I cannot be a tester for < 4.0.3. Sorry.

eiSecure 04-14-2002 09:44 PM

Quote:

Originally posted by xiphoid
w00h00 freddie :) Thank you kindly for this hack, nice one and I can use it! By the way, nice Admin Control Panel theme you got going there.
Isn't that the vB3 admin CP theme? :bunny:

Twig Deez 04-16-2002 08:21 AM

splendid. :)

Freddie Bingham 04-17-2002 01:44 AM

Quote:

Originally posted by eiSecure
Isn't that the vB3 admin CP theme? :bunny:
No, that is just my own vb2 forum.

eoc_Jason 04-17-2002 02:22 AM

I love this little additon to my control panel....

It's Zesty! Yes.... Zesty!

SaintDog 04-17-2002 06:08 AM

Great hack freddie, it is great, no longer will I have to backup my database to get a count on the size of it :).

Great Job,

SaintDog

psico 04-17-2002 08:39 AM

freddie,
Any news about the version for Avatars and Attachs as files?

inetd 04-24-2002 08:04 PM

freddie, i install this hack. But don't see how thread's want moderates in your hack... Please help me.
:)
Please :)

pgowder 04-24-2002 09:23 PM

Love the hack!

But, I get 0's for database data usuage and index usage??

DWZ 04-26-2002 06:07 AM

[high]* DWZ scratches head... err.. I cant find any of that code in admin/index.php ...
[/high]

(using 2.2.5)

EDIT: augh, im an idiot, i know... im using a new program to edit my files and ticked the wrong box in the search window... my bad.. sorry

ceo_tfw 04-26-2002 09:11 AM

I have installed this and it did not take that long to put in, however I would like to add the visits from non.members, how can I did that,
can anyone help

Harvey 04-26-2002 09:59 AM

@ceo_tfw: this would require to develop an extra hack. You would have to store the sessions in the DB for 1 day.

-----------

I made an extension to show modified threads (without # of new threads)
after freddie's
PHP Code:

$newthreads $DB_site->query_first("SELECT count(*) AS count FROM thread WHERE dateline >= $starttime"); 

add
PHP Code:

$changedthreads $DB_site->query_first("SELECT count(*) AS count FROM thread WHERE lastpost >= $starttime"); 

after freddie's
PHP Code:

makelabelcode('New Threads Today:'$newthreads['count']); 

add
PHP Code:

makelabelcode('Modified Threads Today:'$changedthreads['count']-$newthreads['count']); 

Replace 'Modified Threads Today:' by better english if nessesary.

ceo_tfw 04-26-2002 03:33 PM

thanks for that, I have added it great stuff,
I still would like to know how to do the above
thanks

inetd 04-30-2002 06:18 PM

freddir, why "Post Awaiting Moderation:" in Admin Quick Stats don't show? I enable premoderation in some forums.

LouChipher 05-01-2002 11:48 AM

New Threads Today: 8605
Modified Threads Today: -8553

funny effect... and i can't see any reason..

The Realist 05-01-2002 02:08 PM

Working fine, well done :)

Here is my stats:

The Realist 05-01-2002 02:16 PM

Working fine, well done :)

Here is my stats:

Harvey 05-01-2002 05:44 PM

Quote:

Originally posted by LouChipher
New Threads Today: 8605
Modified Threads Today: -8553

funny effect... and i can't see any reason..

Hi,

this can't be my modification. I didn't touch "New Threads".

uff, my english :( I can't explain, but I guess you have 52 modified threads and an unknown number of new threads.

You have to add my lines below freddies lines, not to change anything. But i think you do so.

Our site is OK.

If you don't understand my english, sorry, don't worry. I copuld not help.

cihangir 05-03-2002 12:30 PM

i thicnk i have a little problem with this hack :)

Code:

Server Type
 Linux / PHP v4.1.2
 
MySQL
 v3.23.41
 
Database Data Usage:
 56.02 MB
 
Database Index Usage:
 32.15 MB
 
Attachment Usage:
 0.0 MB
 
Custom Avatar Usage:
 0.03 MB
 
Users Awaiting Moderation:
 0
 
Attachments Awaiting Moderation:
 0
 
New Users Today:
 2
 
Registered Visitors Today:
 58
 
New Threads Today:
 1097
 
New Posts Today:
 17

17 new posts, but 1097 new threads

Mntsnow 05-03-2002 03:50 PM

Very cool! Thanks :)

KuraFire 05-06-2002 09:35 AM

Thx for the hack Freddie, works great. :):up:

I had to remove a small section of the query for Registered Users Today though (the Where clause) because it didn't show up without. Why was it in there, anyway?

ZiRu$ 05-06-2002 08:14 PM

nice stuff :) I will install

Lethal 05-07-2002 10:21 AM

Nice hack freddie, works like a charm.

Dark Odin 05-07-2002 11:39 PM

Is there any plans to make this work with Attachments as Files?

Amasov 05-27-2002 04:31 AM

Great Hack :)

I love this one, since my provider was'nt able to tell me the usage of my database :D :D

Henry-RS 05-27-2002 05:35 AM

Heh....I didn't really like it much above the "Useful Admin Stuff" section, so I put it below it.

If you want to do the same...

Find & Delete:
Code:

if ($moderatenewmembers==1 or $usecoppa==1) {
  $waiting=$DB_site->query_first("SELECT count(*) AS users FROM user WHERE usergroupid=4");
  if ($waiting[users]==0) {
    echo "<font size='1'>There are currently $waiting[users] user(s) awaiting <a href=\"user.php?s=$session[sessionhash]&action=moderate\">moderation</a>.</font>";
  } else {
    echo "<b><a href=\"user.php?s=$session[sessionhash]&action=moderate\">There are currently $waiting[users] user(s) awaiting moderation</a>.</b>";
  }
}

Then Find:
Code:

<tr class="secondalt">
        <td>Useful Links</td>
        <td><select onchange="jumpto(this.options[this.selectedIndex].value)">
                <option>&raquo; Useful Links &laquo;</option>
                <option value="http://www.vbulletin.com/">vBulletin Home Page</option>
                <option value="http://www.vbulletin.com/members/">vBulletin Members' Area</option>
                <option value="http://www.vbulletin.com/forum/">vBulletin Support Forums</option>
                <option value="http://www.vbulletin.com/manual/">vBulletin Online Manual</option>
                <option value="http://www.php.net/">PHP Home Page</option>
                <option value="http://www.php.net/manual/">PHP Online Manual</option>
                <option value="http://www.mysql.com/">MySQL Home Page</option>
                <option value="http://www.mysql.com/documentation/">MySQL Documentation</option>
        </select></td>
</tr>
</form>
</table>
</td></tr></table>
</form>

Add this below:
Code:

<?php

function kbtomb($value) {
        if ($value == 'N/A') {
                return $value;
        } elseif (!$value) {
                return '0.0 MB';
        } else {
                return sprintf('%.2f', $value / 1024000) . ' MB';
        }
}

$starttime = mktime(0, 0, 0, date('m'), date('d'), date('Y'));

$attach = $DB_site->query_first("SELECT SUM(LENGTH(filedata)) AS size FROM attachment");
$avatar = $DB_site->query_first("SELECT SUM(LENGTH(avatardata)) AS size FROM customavatar");

$newusers = $DB_site->query_first("SELECT count(*) AS count FROM user WHERE joindate >= $starttime");
$newthreads = $DB_site->query_first("SELECT count(*) AS count FROM thread WHERE dateline >= $starttime");
$newposts = $DB_site->query_first("SELECT count(*) AS count FROM post WHERE dateline >= $starttime");
$users = $DB_site->query_first("SELECT count(*) AS count FROM user WHERE lastactivity >= $starttime");

$mysqlversion = $DB_site->query_first("SELECT VERSION() AS version");

$indexsize = 0;
$datasize = 0;
if ($mysqlversion['version'] >= '3.23') {
        $DB_site->reporterror = 0;
        $tables = $DB_site->query("SHOW TABLE STATUS");
        $errno = $DB_site->errno;
        $DB_site->reporterror = 1;
        if (!$errno) {
                while ($table = $DB_site->fetch_array($tables)) {
                        $datasize += $table['Data_length'];
                        $indexsize += $table['Index_length'];
                }
                if (!$indexsize) {
                        $indexsize = 'N/A';
                }
                if (!datasize) {
                        $datasize = 'N/A';
                }
        } else {
                $datasize = 'N/A';
                $indexsize = 'N/A';
        }
}

$attachcount = $DB_site->query_first("SELECT count(*) AS count FROM attachment WHERE visible = 0");

$serverinfo = PHP_OS . ' / PHP v' . phpversion();

if (phpversion() >= '4.0.3') {
        $serverinfo .= iif(ini_get('safe_mode'), ' Safe Mode', '');
        $serverinfo .= iif(ini_get('file_uploads'), '', '<br />FILE_UPLOADS disabled');
}

doformheader('', '');
maketableheader('Quick Stats');
makelabelcode('Server Type', $serverinfo);
makelabelcode('MySQL', 'v' . $mysqlversion['version']);
makelabelcode('Database Data Usage:', kbtomb($datasize));
makelabelcode('Database Index Usage:', kbtomb($indexsize));
makelabelcode('Attachment Usage:', kbtomb($attach['size']));
makelabelcode('Custom Avatar Usage:', kbtomb($avatar['size']));

// Only display if the admin has moderation enabled on an active postable forum.
if ($DB_site->query_first("SELECT forumid FROM forum WHERE moderatenew = 1 AND cancontainthreads = 1 AND active = 1 AND allowposting = 1")) {
        $postcount = $DB_site->query_first("SELECT count(*) AS count FROM post WHERE visible=0");
        $threadcount = $DB_site->query_first("SELECT count(*) AS count FROM thread WHERE visible=0");
        makelabelcode("Threads Awaiting <a href=\"../mod/moderate.php?s=$session[sessionhash]&action=posts\">Moderation</a>:", $threadcount['count']);
        makelabelcode("Posts Awaiting <a href=\"../mod/moderate.php?s=$session[sessionhash]&action=posts\">Moderation</a>:", $postcount['count']);
}
if ($moderatenewmembers==1 or $usecoppa==1) {
        $waiting=$DB_site->query_first("SELECT count(*) AS users FROM user WHERE usergroupid=4");
        makelabelcode("Users Awaiting <a href=\"user.php?s=$session[sessionhash]&action=moderate\">Moderation</a>:", $waiting['users']);
}
makelabelcode("Attachments Awaiting <a href=\"../mod/moderate.php?s=$session[sessionhash]&action=attachments\">Moderation</a>:", $attachcount['count']);
makelabelcode('New Users Today:', $newusers['count']);
makelabelcode('Registered Visitors Today:', $users['count']);
makelabelcode('New Threads Today:', $newthreads['count']);
makelabelcode('New Posts Today:', $newposts['count']);
dotablefooter();
?>


:)

Hopefully that'll work for anyone who would actually do it. ;)

cdrforum 05-27-2002 04:26 PM

Superb easy hack well done m8 !! 5 out of 5 !!

yetdog11 06-04-2002 03:11 AM

I am running vB 2.2.2 - I seemingly have installed it correctly, but nothing in my CP looks different. Do I need at least 2.2.5?

Matt
matt@antsmarching.org

Boofo 06-05-2002 06:42 PM

Did you ever get this done and posted? I can't seem to find it in here. Did I miss it? BTW: Great hack, Freddie! :)

Quote:

Originally posted by freddie
I have the version that supports the attachments as files hack as well as some additional stats / averages. I will post it tonight when I get home.

GuruXL 06-05-2002 09:05 PM

Good Hack man, i installed it and it works flawlessly. :p


All times are GMT. The time now is 04:17 AM.

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.01282 seconds
  • Memory Usage 1,842KB
  • 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
  • (4)bbcode_code_printable
  • (8)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete