vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Remove 1 Query Per Page (https://vborg.vbsupport.ru/showthread.php?t=107701)

Trigunflame 02-10-2006 10:00 PM

Remove 1 Query Per Page
 
[CENTER]Remove 1 Database Query Per Page
Reduce your forums query usage !

Summary: (Quoted From Original Hack for vb3)

Removes 1 Query Per Page.

Instructions:

1. Open includes/class_core.php
2. Go to about line 2538 and look for
PHP Code:

$this->set('location'WOLPATH); 

3. Above that, paste the following.
PHP Code:

$this->set('old_location'$session['location']); 

4. Go to about line 2818 and look for the following:
PHP Code:

            // registered user
            
if (!SESSION_BYPASS)
            {
                if (
TIMENOW $this->userinfo['lastactivity'] > $this->registry->options['cookietimeout'])
                {
                    
// see if session has 'expired' and if new post indicators need resetting
                    
$this->registry->db->shutdown_query("
                        UPDATE " 
TABLE_PREFIX "user
                        SET
                            lastvisit = lastactivity,
                            lastactivity = " 
TIMENOW "
                        WHERE userid = " 
$this->userinfo['userid'] . "
                    "
'lastvisit');

                    
$this->userinfo['lastvisit'] = $this->userinfo['lastactivity'];
                }
                else
                {
                        
$this->registry->db->shutdown_query("
                            UPDATE " 
TABLE_PREFIX "user
                            SET lastactivity = " 
TIMENOW "
                            WHERE userid = " 
$this->userinfo['userid'] . "
                            "
'lastvisit');
                }
            } 

5. Replace that with the following:
PHP Code:

            // registered user
            
if (!SESSION_BYPASS)
            {
                if (
TIMENOW $this->userinfo['lastactivity'] > $this->registry->options['cookietimeout'])
                {
                    
// see if session has 'expired' and if new post indicators need resetting
                    
$this->registry->db->shutdown_query("
                        UPDATE " 
TABLE_PREFIX "user
                        SET
                            lastvisit = lastactivity,
                            lastactivity = " 
TIMENOW "
                        WHERE userid = " 
$this->userinfo['userid'] . "
                    "
'lastvisit');

                    
$this->userinfo['lastvisit'] = $this->userinfo['lastactivity'];
                }
                elseif (
$this->vars['old_location'] != WOLPATH || THIS_SCRIPT == 'misc' || THIS_SCRIPT == 'online')
                {
                    
$this->registry->db->shutdown_query("
                        UPDATE " 
TABLE_PREFIX "user
                        SET lastactivity = " 
TIMENOW "
                        WHERE userid = " 
$this->userinfo['userid'] . "
                        "
'lastvisit');
                }
            } 


Corriewf 02-11-2006 08:42 AM

Awesome! Thanks!

Trigunflame 02-11-2006 09:38 AM

Quote:

Originally Posted by Corriewf
Awesome! Thanks!

Welcomez :)

Protoman 02-11-2006 01:56 PM

think the vB team will add this to the next version??

Zia 02-11-2006 02:40 PM

[high]* Zia kliks install
[/high]

Trigunflame :) what is next tremendious idea to make page laod faster & fatser ?

:D

Kihon Kata 02-11-2006 04:40 PM

INstalled! Thanks! but I am running ministats and I am not seeing a decrease on queries listed in there during page loads.

Trigunflame 02-11-2006 06:29 PM

Because if you would look at the query:

$this->registry->db->shutdown_query()

It is a shutdown query that is run as the script is ending, and is not shown in any query counters. Nevertheless it is still sending that query to your forums mysql database which affects the system.

I didnt say this would necessarily make your forum "Faster", I just said it would reduce a query, lol.

Go read my thread in vb3 if you dont believe me...

GenSec 02-11-2006 08:08 PM

/me cliks install

Thank you, very usefull!

GenSec 02-11-2006 08:24 PM

/me cliks install

Thank you, very usefull!

Trigunflame 02-11-2006 10:29 PM

Quote:

Originally Posted by GenSec
[high]* GenSec cliks install
[/high]

Thank you, very usefull!

Doublepost, might wanna delete one; lol.


All times are GMT. The time now is 04:48 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.01071 seconds
  • Memory Usage 1,767KB
  • 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_php_printable
  • (2)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
  • (10)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