Page 1 of 2

Site Problems

PostPosted: Sat Feb 17, 2007 10:20 am
by Coorong
I have noticed over the past month or so (for me) reaction time on this site has slowed. As I am on cable I am surprised. Mostly when I click on a topic, have to do it 2 or 3 times to respond. Sometimes have to right click and open. Even this can take 5-10 seconds.

Not experincing this on any other forums or programmes I run. Any suggestions?

Footnote: submitting this post took 37 seconds which is more usual now than before

PostPosted: Sat Feb 17, 2007 11:07 am
by Footy Chick
Ditto Coorong, only I've only noticed it over the past week, I have to right click and open most topics, or I'm getting the critical error thing again....

PostPosted: Sat Feb 17, 2007 11:15 am
by Punk Rooster
yes, I agree.
The only solution is to burn Wedgie's house down.

PostPosted: Sat Feb 17, 2007 11:26 am
by Thiele
I agree to

PostPosted: Sat Feb 17, 2007 11:38 am
by Footy Chick
Thiele wrote:I agree to


to burn Wedgies house down?

Thats a bit harsh :shock:

PostPosted: Sat Feb 17, 2007 11:40 am
by Thiele
Falcon Chick wrote:
Thiele wrote:I agree to


to burn Wedgies house down?

Thats a bit harsh :shock:
Not to burnSir Wedgies house down but i problems with the site

PostPosted: Sat Feb 17, 2007 11:40 am
by Thiele
Falcon Chick wrote:
Thiele wrote:I agree to


to burn Wedgies house down?

Thats a bit harsh :shock:
Not to burn Sir Wedgies house down but i problems with the site

PostPosted: Sat Feb 17, 2007 11:56 am
by magpie in the 80's
i also concur to this problem

PostPosted: Sat Feb 17, 2007 12:49 pm
by Wedgie
Hmmm, I haven't had any probs but thanks for making me aware of it, I'll try messing around with the servers and see if I can speed things up, might be just the sheer weight of numbers of posts on here and the only solution may be to cull posts after a certain timeframe, I know spelly would hate that option so it'll be my last one.
I'll see what I can do folks and apologies for any slowness.

PostPosted: Sat Feb 17, 2007 1:03 pm
by Wedgie
Ive found a couple of mods that may quicken up the website, I'll try installing them over the weekend as they take about an hour to change all the code on.

PostPosted: Sat Feb 17, 2007 1:06 pm
by am Bays
Wedgie wrote:Ive found a couple of mods that may quicken up the website, I'll try installing them over the weekend as they take about an hour to change all the code on.


So us old mods are sacked are we???? :shock: :shock:

PostPosted: Sat Feb 17, 2007 1:08 pm
by Wedgie
1980 Tassie Medalist wrote:
Wedgie wrote:Ive found a couple of mods that may quicken up the website, I'll try installing them over the weekend as they take about an hour to change all the code on.


So us old mods are sacked are we???? :shock: :shock:


lol, sorry, modifications, not moderators! :wink:

PostPosted: Sat Feb 17, 2007 1:58 pm
by Snaggletooth Tiger
1980 Tassie Medalist wrote:So us old mods are sacked are we???? :shock: :shock:


Cue for a pissweak 'QUADROPHENIA' reference I reckon! :wink: :roll:

PostPosted: Sat Feb 17, 2007 2:02 pm
by Coorong
You must have tweaked someting allready as I am now getting a much speedier response.

PostPosted: Sat Feb 17, 2007 2:32 pm
by Wedgie
Nah, but now I have, seems to be heaps quicker, I didn't realise how slow it had got.
Can people let me know if its still slow for them or if its a lot quicker now?

PostPosted: Sat Feb 17, 2007 2:47 pm
by Thiele
its quicker now thanks :)

PostPosted: Sat Feb 17, 2007 2:50 pm
by Punk Rooster
there's no reason why we still can't do what I suggested! :wink:

PostPosted: Sat Feb 17, 2007 3:18 pm
by Wedgie
Coorong wrote:You must have tweaked someting allready as I am now getting a much speedier response.

Actually I just remembered that I did upload a new config file earlier beforI changed the rest of the code so that might have helped.

Here's the "little" bit of code I had to change to get it working as it now is:

Code: Select all
#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#
Create a cache/ directory in your phpBB root folder and CHMOD to 777.

#
#-----[ COPY ]------------------------------------------
# Upload this if you have extreme styles MOD installed.
copy admin/xs_cached_generation.cfg to admin/xs_cached_generation.cfg

#
#-----[ OPEN ]------------------------------------------
#
common.php

#
#-----[ FIND ]------------------------------------------
#
// 
// Define some basic configuration arrays this also prevents

#
#-----[ BEFORE, ADD ]------------------------------------------
#
function microtime_float() 

   list($usec, $sec) = explode(" ", microtime()); 
   return ((float)$usec + (float)$sec); 

 
$GLOBALS['page_gen_start'] = microtime_float();

#
#-----[ FIND ]------------------------------------------
#
   FROM " . CONFIG_TABLE;
if( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
   FROM " . CONFIG_TABLE;
if( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ OPEN ]------------------------------------------
#
index.php

#
#-----[ FIND ]------------------------------------------
#
   ORDER BY c.cat_order";
if( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
   ORDER BY c.cat_order";
if( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ FIND ]------------------------------------------
#
         break;
   }
   if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
         break;
   }
   if ( !($result = $db->sql_query($sql, false, 'posts_')) )

#
#-----[ FIND ]------------------------------------------
#
      ORDER BY aa.forum_id, u.user_id";
   if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
      ORDER BY aa.forum_id, u.user_id";
   if ( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ FIND ]------------------------------------------
#
      ORDER BY aa.forum_id, g.group_id";
   if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
      ORDER BY aa.forum_id, g.group_id";
   if ( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ OPEN ]------------------------------------------
#
viewforum.php

#
#-----[ FIND ]------------------------------------------
#
      WHERE forum_id = $forum_id";
   if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
      WHERE forum_id = $forum_id";
   if ( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ FIND ]------------------------------------------
#
         WHERE forum_id = $forum_id";
      if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
         WHERE forum_id = $forum_id";
      if ( !($result = $db->sql_query($sql, false, 'posts_')) )

#
#-----[ FIND ]------------------------------------------
#
   GROUP BY u.user_id, u.username 
   ORDER BY u.user_id";
if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
   GROUP BY u.user_id, u.username 
   ORDER BY u.user_id";
if ( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ FIND ]------------------------------------------
#
   GROUP BY g.group_id, g.group_name 
   ORDER BY g.group_id";
if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
   GROUP BY g.group_id, g.group_name 
   ORDER BY g.group_id";
if ( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ FIND ]------------------------------------------
#
         AND p.post_time >= $min_topic_time";

   if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
         AND p.post_time >= $min_topic_time";

   if ( !($result = $db->sql_query($sql, false, 'posts_')) )

#
#-----[ FIND ]------------------------------------------
#
   ORDER BY t.topic_last_post_id DESC ";
if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
   ORDER BY t.topic_last_post_id DESC ";
if ( !($result = $db->sql_query($sql, false, 'posts_')) )

#
#-----[ FIND ]------------------------------------------
#
$topic_rowset = array();

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$cached1 = $db->cached;

#
#-----[ FIND ]------------------------------------------
#
   LIMIT $start, ".$board_config['topics_per_page'];
if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
   LIMIT $start, ".$board_config['topics_per_page'];
if ( !($result = $db->sql_query($sql, false, 'posts_')) )

#
#-----[ FIND ]------------------------------------------
#
$total_topics = 0;

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$cached2 = $db->cached;

#
#-----[ FIND ]------------------------------------------
#
//
// Total topics ...
//

#
#-----[ BEFORE, ADD ]------------------------------------------
#

if($cached1 || $cached2)
{
   $update_list = array();
   for($i=0; $i<count($topic_rowset); $i++)
   {
      $update_list[] = $topic_rowset[$i]['topic_id'];
   }
   if(count($update_list))
   {
      $sql = "SELECT topic_id, topic_views FROM " . TOPICS_TABLE . " WHERE topic_id IN (" . implode(', ', $update_list) . ")";
      $list = array();
      $result = $db->sql_query($sql);
      while( $row = $db->sql_fetchrow($result) )
      {
         $list[$row['topic_id']] = $row['topic_views'];
      }
      $db->sql_freeresult($result);
      for($i=0; $i<count($topic_rowset); $i++)
      {
         if(isset($list[$topic_rowset[$i]['topic_id']]))
         {
            $topic_rowset[$i]['topic_views'] = $list[$topic_rowset[$i]['topic_id']];
         }
      }
      unset($list);
   }
}

#
#-----[ OPEN ]------------------------------------------
#
groupcp.php

#
#-----[ FIND ]------------------------------------------
#
   $message = $lang['Group_type_updated'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');



#-----[ AFTER, ADD ]------------------------------------------ 

   $db->clear_cache();

#
#-----[ FIND ]------------------------------------------
#
   $message = $lang['Group_joined'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');


#-----[ AFTER, ADD ]------------------------------------------ 

   $db->clear_cache();

#
#-----[ FIND ]------------------------------------------
#
      $message = $lang['Unsub_success'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');


#-----[ AFTER, ADD ]------------------------------------------ 

      $db->clear_cache();

#
#-----[ FIND ]------------------------------------------
#
                  message_die(GENERAL_ERROR, 'Could not update user group table', '', __LINE__, __FILE__, $sql);
               }


#-----[ AFTER, ADD ]------------------------------------------ 
#
               $db->clear_cache();

#
#-----[ OPEN ]------------------------------------------
#
modcp.php

#
#-----[ FIND ]------------------------------------------
#
         message_die(GENERAL_MESSAGE, $lang['Topics_Removed'] . '<br /><br />' . $l_redirect);


#-----[ BEFORE, ADD ]------------------------------------------ 
#
         $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
            $message = $lang['Topics_Moved'] . '<br /><br />';


#-----[ AFTER, ADD ]------------------------------------------ 
#
            $db->clear_cache('posts_');
#
#-----[ FIND ]------------------------------------------
#
      message_die(GENERAL_MESSAGE, $lang['Topics_Locked'] . '<br /><br />' . $message);


#-----[ BEFORE, ADD ]------------------------------------------ 
#
      $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
      message_die(GENERAL_MESSAGE, $lang['Topics_Unlocked'] . '<br /><br />' . $message);


#-----[ BEFORE, ADD ]------------------------------------------ 
#
      $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
            $message = $lang['Topic_split'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;sid=" . $userdata['session_id'] . '">', '</a>');


#-----[ AFTER, ADD ]------------------------------------------ 
#
            $db->clear_cache('posts_');

#
#-----[ OPEN ]------------------------------------------
#
includes/auth.php

#
#-----[ FIND ]------------------------------------------
#
            AND a.group_id = ug.group_id
            $forum_match_sql";
      if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
            AND a.group_id = ug.group_id
            $forum_match_sql";
      if ( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php

#
#-----[ FIND ]------------------------------------------
#
            FROM " . FORUMS_TABLE;
         break;
   }

   if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
            FROM " . FORUMS_TABLE;
         break;
   }

   if ( !($result = $db->sql_query($sql, false, 'posts_')) )


#-----[ FIND ]------------------------------------------ 

   $row = $db->sql_fetchrow($result); 
 

#-----[ AFTER, ADD ]------------------------------------------ 

   $db->sql_freeresult($result); 

#
#-----[ FIND ]------------------------------------------
#
      ORDER BY c.cat_order";
   if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
      ORDER BY c.cat_order";
   if ( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ FIND ]------------------------------------------
#
         ORDER BY cat_id, forum_order";
      if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#

         ORDER BY cat_id, forum_order";
      if ( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ FIND ]------------------------------------------
#
      FROM  " . WORDS_TABLE;
   if( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
      FROM  " . WORDS_TABLE;
   if( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php

#
#-----[ FIND ]------------------------------------------
#
            FROM " . BANLIST_TABLE;
         if (!($result = $db->sql_query($sql)))

#
#-----[ REPLACE WITH ]------------------------------------------
#
            FROM " . BANLIST_TABLE;
         if (!($result = $db->sql_query($sql, false, true)))

#
#-----[ FIND ]------------------------------------------
#
      ORDER BY smilies_id";
   if ($result = $db->sql_query($sql))

#
#-----[ REPLACE WITH ]------------------------------------------
#
      ORDER BY smilies_id";
   if ($result = $db->sql_query($sql, false, true))

#
#-----[ FIND ]------------------------------------------
#
   if (!$db->sql_query($sql, BEGIN_TRANSACTION))
   {

#
#-----[ AFTER, ADD ]------------------------------------------
#
      $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
   $sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message',  bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id";
   if (!$db->sql_query($sql))
   {

#
#-----[ AFTER, ADD ]------------------------------------------
#
      $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
      $sql = (!$post_data['has_poll']) ? "INSERT INTO " . VOTE_DESC_TABLE . " (topic_id, vote_text, vote_start, vote_length) VALUES ($topic_id, '$poll_title', $current_time, " . ($poll_length * 86400) . ")" : "UPDATE " . VOTE_DESC_TABLE . " SET vote_text = '$poll_title', vote_length = " . ($poll_length * 86400) . " WHERE topic_id = $topic_id";
      if (!$db->sql_query($sql))
      {
#
#-----[ AFTER, ADD ]------------------------------------------
#
         $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
            ORDER BY vote_option_id ASC";
         if (!($result = $db->sql_query($sql)))
         {

#
#-----[ AFTER, ADD ]------------------------------------------
#
            $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
            $sql = ($mode != "editpost" || !isset($old_poll_result[$option_id])) ? "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES ($poll_id, $poll_option_id, '$option_text', $poll_result)" : "UPDATE " . VOTE_RESULTS_TABLE . " SET vote_option_text = '$option_text', vote_result = $poll_result WHERE vote_option_id = $option_id AND vote_id = $poll_id";
            if (!$db->sql_query($sql))
            {
#
#-----[ AFTER, ADD ]------------------------------------------
#
               $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
               AND vote_id = $poll_id";
         if (!$db->sql_query($sql))
         {

#
#-----[ AFTER, ADD ]------------------------------------------
#
            $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
               AND u.user_id = tw.user_id";
      if (!($result = $db->sql_query($sql)))
      {

#
#-----[ AFTER, ADD ]------------------------------------------
#
         $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
   $message = $lang['Stored'] . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');

#
#-----[ AFTER, ADD ]------------------------------------------
#
   $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
               WHERE topic_id = $topic_id";
            if (!($result = $db->sql_query($sql)))
            {

#
#-----[ AFTER, ADD ]------------------------------------------
#
               $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
               WHERE forum_id = $forum_id";
            if (!($result = $db->sql_query($sql)))
            {

#
#-----[ AFTER, ADD ]------------------------------------------
#
               $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
            WHERE topic_id = $topic_id";
         if (!($result = $db->sql_query($sql)))
         {

#
#-----[ AFTER, ADD ]------------------------------------------
#
            $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
      WHERE forum_id = $forum_id";
   if (!$db->sql_query($sql))
   {

#
#-----[ AFTER, ADD ]------------------------------------------
#
      $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
         WHERE topic_id = $topic_id";
      if (!$db->sql_query($sql))
      {

#
#-----[ AFTER, ADD ]------------------------------------------
#
         $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
         WHERE user_id = $user_id";
      if (!$db->sql_query($sql, END_TRANSACTION))
      {

#
#-----[ AFTER, ADD ]------------------------------------------
#
         $db->clear_cache('posts_');


#
#-----[ FIND ]------------------------------------------
#
   return;
}

//
// Delete a post/poll
//

#
#-----[ BEFORE, ADD ]------------------------------------------
#
   $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
      $sql = "DELETE FROM " . POSTS_TABLE . "
         WHERE post_id = $post_id";
      if (!$db->sql_query($sql))
      {

#
#-----[ AFTER, ADD ]------------------------------------------
#
         $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
      $sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
         WHERE post_id = $post_id";
      if (!$db->sql_query($sql))
      {


#
#-----[ AFTER, ADD ]------------------------------------------
#
         $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
                  OR topic_moved_id = $topic_id";
            if (!$db->sql_query($sql))
            {

#
#-----[ AFTER, ADD ]------------------------------------------
#
               $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
            $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
               WHERE topic_id = $topic_id";
            if (!$db->sql_query($sql))
            {

#
#-----[ AFTER, ADD ]------------------------------------------
#
               $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
      $sql = "DELETE FROM " . VOTE_DESC_TABLE . "
         WHERE topic_id = $topic_id";
      if (!$db->sql_query($sql))
      {

#
#-----[ AFTER, ADD ]------------------------------------------
#
         $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
      $sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
         WHERE vote_id = $poll_id";
      if (!$db->sql_query($sql))
      {
#
#-----[ AFTER, ADD ]------------------------------------------
#
         $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
      $sql = "DELETE FROM " . VOTE_USERS_TABLE . "
         WHERE vote_id = $poll_id";
      if (!$db->sql_query($sql))
      {

#
#-----[ AFTER, ADD ]------------------------------------------
#
         $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
   $message .=  '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');

#
#-----[ AFTER, ADD ]------------------------------------------
#
   $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
            message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql);

#
#-----[ BEFORE, ADD ]------------------------------------------
#
            $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
            AND user_id = " . $userdata['user_id'];
      if (!($result = $db->sql_query($sql)))
      {
#
#-----[ AFTER, ADD ]------------------------------------------
#
         $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
            WHERE topic_id = $topic_id
               AND user_id = " . $userdata['user_id'];
         if (!$db->sql_query($sql))
         {
#
#-----[ AFTER, ADD ]------------------------------------------
#
            $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
            VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
         if (!$db->sql_query($sql))
         {

#
#-----[ AFTER, ADD ]------------------------------------------
#
            $db->clear_cache('posts_');

#
#-----[ FIND ]------------------------------------------
#
}

//
// Fill smiley templates (or just the variables) with smileys
// Either in a window or inline
//

#
#-----[ BEFORE, ADD ]------------------------------------------
#
   $db->clear_cache('posts_');


#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php

#
#-----[ FIND ]------------------------------------------
#
         OR ban_email LIKE '" . substr(str_replace("\'", "''", $userdata['user_email']), strpos(str_replace("\'", "''", $userdata['user_email']), "@")) . "'";
   }
   if ( !($result = $db->sql_query($sql)) )

#
#-----[ REPLACE WITH ]------------------------------------------
#
         OR ban_email LIKE '" . substr(str_replace("\'", "''", $userdata['user_email']), strpos(str_replace("\'", "''", $userdata['user_email']), "@")) . "'";
   }
   if ( !($result = $db->sql_query($sql, false, true)) )

#
#-----[ OPEN ]------------------------------------------
#
#
mysql.php

#
#-----[ FIND ]------------------------------------------
#
   var $num_queries = 0;

#
#-----[ AFTER, ADD ]------------------------------------------
#
   var $caching = false;
   var $cached = false;
   var $cache = array();

#
#-----[ FIND ]------------------------------------------
#
   function sql_query($query = "", $transaction = FALSE)

#
#-----[ REPLACE WITH ]------------------------------------------
#
   function sql_query($query = "", $transaction = FALSE, $cache = false)

#
#-----[ FIND ]------------------------------------------
#
      // Remove any pre-existing queries
      unset($this->query_result);

#
#-----[ AFTER, ADD ]------------------------------------------
#
      // Check cache
      $this->caching = false;
      $this->cache = array();
      $this->cached = false;
      if($query !== '' && $cache)
      {
         global $phpbb_root_path;
         $hash = md5($query);
         if(strlen($cache))
         {
            $hash = $cache . $hash;
         }
         $filename = $phpbb_root_path . 'cache/sql_' . $hash . '.php';
         if(@file_exists($filename))
         {
            $set = array();
            include($filename);
            $this->cache = $set;
            $this->cached = true;
            $this->caching = false;
            return 'cache';
         }
//         echo 'cache is missing: ', $filename, '<br />';
         $this->caching = $hash;
      }
      // not cached
//      echo 'sql: ', htmlspecialchars($query), '<br />';

#
#-----[ FIND ]------------------------------------------
#
   function sql_numrows($query_id = 0)
   {

#
#-----[ AFTER, ADD ]------------------------------------------
#
      if($query_id === 'cache' && $this->cached)
      {
         return count($this->cache);
      }

#
#-----[ FIND ]------------------------------------------
#
   function sql_fetchrow($query_id = 0)
   {

#
#-----[ AFTER, ADD ]------------------------------------------
#
      if($query_id === 'cache' && $this->cached)
      {
         return count($this->cache) ? array_shift($this->cache) : false;
      }

#
#-----[ FIND ]------------------------------------------
#
      if($query_id)
      {
         $this->row[$query_id] = @mysql_fetch_array($query_id);


#
#-----[ AFTER, ADD ]------------------------------------------
#
         if($this->caching)
         {
            if($this->row[$query_id] === false)
            {
               $this->write_cache();
            }
            $this->cache[] = $this->row[$query_id];
         }

#
#-----[ FIND ]------------------------------------------
#
   function sql_fetchrowset($query_id = 0)
   {

#
#-----[ AFTER, ADD ]------------------------------------------
#
      if($query_id === 'cache' && $this->cached)
      {
         return $this->cache;
      }

#
#-----[ FIND ]------------------------------------------
#
         unset($this->row[$query_id]);
         while($this->rowset[$query_id] = @mysql_fetch_array($query_id))
         {

#
#-----[ AFTER, ADD ]------------------------------------------
#
            if($this->caching)
            {
               if($this->row[$query_id] === false)
               {
                  $this->write_cache();
               }
               $this->cache[] = $this->row[$query_id];
            }

#
#-----[ FIND ]------------------------------------------
#
            $result[] = $this->rowset[$query_id];
         }

#
#-----[ AFTER, ADD ]------------------------------------------
#
         if($this->caching)
         {
            $this->write_cache();
         }

#
#-----[ FIND ]------------------------------------------
#
   function sql_freeresult($query_id = 0){

#
#-----[ AFTER, ADD ]------------------------------------------
#
      if($query_id === 'cache')
      {
         $this->caching = false;
         $this->cached = false;
         $this->cache = array();
      }
      if($this->caching)
      {
         $this->write_cache();
      }

#
#-----[ FIND ]------------------------------------------
#
} // class sql_db

#
#-----[ BEFORE, ADD ]------------------------------------------
#
   function write_cache()
   {
      if(!$this->caching)
      {
         return;
      }
      global $phpbb_root_path;
      $f = fopen($phpbb_root_path . 'cache/sql_' . $this->caching . '.php', 'w');
      $data = var_export($this->cache, true);
      @fputs($f, '<?php $set = ' . $data . '; ?>');
      @fclose($f);
      @chmod($phpbb_root_path . 'cache/sql_' . $this->caching . '.php', 0777);
      $this->caching = false;
      $this->cached = false;
      $this->cache = array();
   }

   function clear_cache($prefix = '')
   {
      global $phpbb_root_path;
      $this->caching = false;
      $this->cached = false;
      $this->cache = array();
      $prefix = 'sql_' . $prefix;
      $prefix_len = strlen($prefix);
      $res = opendir($phpbb_root_path . 'cache');
      if($res)
      {
         while(($file = readdir($res)) !== false)
         {
            if(substr($file, 0, $prefix_len) === $prefix)
            {
               @unlink($phpbb_root_path . 'cache/' . $file);
            }
         }
      }
      @closedir($res);
   }

#
#-----[ OPEN ]------------------------------------------
#
#
mysql4.php

#
#-----[ FIND ]------------------------------------------
#
   var $num_queries = 0;

#
#-----[ AFTER, ADD ]------------------------------------------
#
   var $caching = false;
   var $cached = false;
   var $cache = array();

#
#-----[ FIND ]------------------------------------------
#
   function sql_query($query = "", $transaction = FALSE)

#
#-----[ REPLACE WITH ]------------------------------------------
#
   function sql_query($query = "", $transaction = FALSE, $cache = false)

#
#-----[ FIND ]------------------------------------------
#
      // Remove any pre-existing queries
      unset($this->query_result);

#
#-----[ AFTER, ADD ]------------------------------------------
#
      // Check cache
      $this->caching = false;
      $this->cache = array();
      $this->cached = false;
      if($query !== '' && $cache)
      {
         global $phpbb_root_path;
         $hash = md5($query);
         if(strlen($cache))
         {
            $hash = $cache . $hash;
         }
         $filename = $phpbb_root_path . 'cache/sql_' . $hash . '.php';
         if(@file_exists($filename))
         {
            $set = array();
            include($filename);
            $this->cache = $set;
            $this->cached = true;
            $this->caching = false;
            return 'cache';
         }
//         echo 'cache is missing: ', $filename, '<br />';
         $this->caching = $hash;
      }
      // not cached
//      echo 'sql: ', htmlspecialchars($query), '<br />';

#
#-----[ FIND ]------------------------------------------
#
   function sql_numrows($query_id = 0)
   {

#
#-----[ AFTER, ADD ]------------------------------------------
#
      if($query_id === 'cache' && $this->cached)
      {
         return count($this->cache);
      }

#
#-----[ FIND ]------------------------------------------
#
   function sql_fetchrow($query_id = 0)
   {

#
#-----[ AFTER, ADD ]------------------------------------------
#
      if($query_id === 'cache' && $this->cached)
      {
         return count($this->cache) ? array_shift($this->cache) : false;
      }

#
#-----[ FIND ]------------------------------------------
#
      if( $query_id )
      {
         $this->row[$query_id] = mysql_fetch_array($query_id, MYSQL_ASSOC);

#
#-----[ AFTER, ADD ]------------------------------------------
#
         if($this->caching)
         {
            if($this->row[$query_id] === false)
            {
               $this->write_cache();
            }
            $this->cache[] = $this->row[$query_id];
         }

#
#-----[ FIND ]------------------------------------------
#
   function sql_fetchrowset($query_id = 0)
   {

#
#-----[ AFTER, ADD ]------------------------------------------
#
      if($query_id === 'cache' && $this->cached)
      {
         return $this->cache;
      }

#
#-----[ FIND ]------------------------------------------
#
         unset($this->row[$query_id]);
         while($this->rowset[$query_id] = mysql_fetch_array($query_id, MYSQL_ASSOC))
         {

#
#-----[ AFTER, ADD ]------------------------------------------
#
            if($this->caching)
            {
               if($this->row[$query_id] === false)
               {
                  $this->write_cache();
               }
               $this->cache[] = $this->row[$query_id];
            }

#
#-----[ FIND ]------------------------------------------
#
            $result[] = $this->rowset[$query_id];
         }

#
#-----[ AFTER, ADD ]------------------------------------------
#
         if($this->caching)
         {
            $this->write_cache();
         }

#
#-----[ FIND ]------------------------------------------
#
   function sql_freeresult($query_id = 0)
   {

#
#-----[ AFTER, ADD ]------------------------------------------
#
      if($query_id === 'cache')
      {
         $this->caching = false;
         $this->cached = false;
         $this->cache = array();
      }
      if($this->caching)
      {
         $this->write_cache();
      }

#
#-----[ FIND ]------------------------------------------
#
         mysql_free_result($query_id);

#
#-----[ REPLACE WITH ]------------------------------------------
#
         @mysql_free_result($query_id);

#
#-----[ FIND ]------------------------------------------
#
} // class sql_db

#
#-----[ BEFORE, ADD ]------------------------------------------
#
   function write_cache()
   {
      if(!$this->caching)
      {
         return;
      }
      global $phpbb_root_path;
      $f = fopen($phpbb_root_path . 'cache/sql_' . $this->caching . '.php', 'w');
      $data = var_export($this->cache, true);
      @fputs($f, '<?php $set = ' . $data . '; ?>');
      @fclose($f);
      @chmod($phpbb_root_path . 'cache/sql_' . $this->caching . '.php', 0777);
      $this->caching = false;
      $this->cached = false;
      $this->cache = array();
   }

   function clear_cache($prefix = '')
   {
      global $phpbb_root_path;
      $this->caching = false;
      $this->cached = false;
      $this->cache = array();
      $prefix = 'sql_' . $prefix;
      $prefix_len = strlen($prefix);
      $res = opendir($phpbb_root_path . 'cache');
      if($res)
      {
         while(($file = readdir($res)) !== false)
         {
            if(substr($file, 0, $prefix_len) === $prefix)
            {
               @unlink($phpbb_root_path . 'cache/' . $file);
            }
         }
      }
      @closedir($res);
   }

#
#-----[ OPEN ]------------------------------------------
#
admin/page_footer_admin.php

#
#-----[ FIND ]------------------------------------------
#
$db->sql_close();

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$db->clear_cache();

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
// Cached generation
//
$lang['debug_generation'] = 'Debug: page generation = %s seconds,';
$lang['sql_queries'] = 'sql queries = %s';

#
#-----[ OPEN ]------------------------------------------
#
includes/page_tail.php

#
#-----[ FIND ]------------------------------------------
#
   'overall_footer' => ( empty($gen_simple_header) ) ? 'overall_footer.tpl' : 'simple_footer.tpl')
);

#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// Cached Generation
//
$page_gen_time = sprintf('%.5f', microtime_float() - $GLOBALS['page_gen_start']);

#
#-----[ FIND ]------------------------------------------
#
$template->assign_vars(array(

#
#-----[ AFTER, ADD ]------------------------------------------
#
   // Cached Generation   
   'PAGE_GENERATION' => sprintf($lang['debug_generation'], $page_gen_time),
   'MYSQL_QUERIES' => sprintf($lang['sql_queries'], $db->num_queries),

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_footer.tpl

#
#-----[ FIND ]------------------------------------------
#
Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> &copy; 2001, 2005 phpBB Group<br />{TRANSLATION_INFO}</span></div>

#
#-----[ IN-LINE FIND ]------------------------------------------
#
{TRANSLATION_INFO}

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<br />{PAGE_GENERATION}&nbsp;{MYSQL_QUERIES}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

PostPosted: Sat Feb 17, 2007 3:30 pm
by magpie in the 80's
yep that will fix the problem wedgie :wink:

and it has. much quicker now

PostPosted: Sat Feb 17, 2007 4:40 pm
by Ian
Heaps quicker now.