[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');
}
}