Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Details »»

Version: , by Scott MacVicar Scott MacVicar is offline
Developer Last Online: Mar 2016 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 09-20-2001 Last Update: Never Installs: 85
 
No support by the author.

I had tried a version suggested by someone else instead of my own and well, all it did was send the load average up by about 10 times what it was.

This version inserts the last title into the forum database when it is updating the last post name and time. There is no difference in loading time as everything is called normally by vBulletin.

This works on 2.0.x and 2.2.x

Updated at 11:34 GMT on 28th September 2002

Thanks to floren for the latest update.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #272  
Old 09-26-2002, 10:58 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

and you are right about the editing. i missed the title part. thank you.
i'm gonna ask scott to move it on top the file, since it fixed the last bug we all had problems with.
Reply With Quote
  #273  
Old 09-27-2002, 09:41 AM
Dark Jim's Avatar
Dark Jim Dark Jim is offline
 
Join Date: Apr 2002
Location: Netherlands
Posts: 174
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works with the current version of the lasttitle hack. (Not fully my work, read 2 pages earlier in this topic.) I will (try to) update it everytime PPN/Teck update the last title hack.

Run this query:
PHP Code:
ALTER TABLE forum ADD lasticon SMALLINT(5NOT NULL AFTER lastthread
File: FORUM/admin/functions.php
Find:
PHP Code:
  $lastpost=0;
  
$lastthread='';
  
$lastposter=''
Add after that:
PHP Code:
  $lasticon=''
Find:
PHP Code:
        if($getchildforum[lastthread]=='') {
          
$threadtitle=$DB_site->fetch_array($DB_site->query("SELECT * FROM thread WHERE forumid='$forumid' AND lastposter='$getchildforum[lastposter]' AND lastpost='$getchildforum[lastpost]'"));
          
$lastthread=$threadtitle[title];
        } else {
          
$lastthread=$getchildforum[lastthread];
        } 
Add after that:
PHP Code:
        if($getchildforum[lasticon]=='') {
          
$posticon=$DB_site->query_first("SELECT iconid FROM post WHERE dateline='$threadtitle[lastpost]' AND username='$threadtitle[lastposter]'");
          
$lasticon=$posticon[iconid];
        } else {
          
$lasticon=$getchildforum[lasticon];
        } 
Find:
PHP Code:
  $lastposts=$DB_site->query_first("SELECT MAX(title) as title,MAX(lastpost) AS lastpost FROM thread WHERE forumid=$forumid AND visible=1 AND open<>10");
  if (
$lastposts['lastpost']>$lastpost) {
    
$lastposts=$DB_site->query_first("
      SELECT lastpost,lastposter,title
      FROM thread
      WHERE forumid = 
$forumid AND lastpost = '$lastposts[lastpost]'");
    
$lastpost=$lastposts['lastpost'];
    
$lastthread=$lastposts['title'];
    
$lastposter=$lastposts['lastposter'];
  } 
Add after that:
PHP Code:
  $posticon=$DB_site->query_first("SELECT iconid FROM post WHERE dateline='$lastposts[lastpost]' AND username='$lastposts[lastposter]'");
  
$lasticon=$posticon['iconid']; 
Find:
PHP Code:
$lastpostquery=",lastpost='$lastpost',lastthread='".addslashes($lastthread)."',lastposter='".addslashes($lastposter)."'"
Replace with:
PHP Code:
  $lastpostquery=",lastpost='$lastpost',lastthread='".addslashes($lastthread)."',lasticon='$lasticon',lastposter='".addslashes($lastposter)."'"
File: FORUM/index.php
Find:
PHP Code:
           if (strlen($forum['lastthread']) > $maxchars) {
              
$forum['lastthread'] = substr($forum['lastthread'], 0$maxchars-2) . '...';
            } 
Add after that:
PHP Code:
            if ($forum['lasticon']) {
              
$icon="<img src=\"$forum[iconpath]\" alt=\"$forum[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
            } else {
              
$icon="";
            } 
Find:
PHP Code:
//Forum info
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder'); 
Replace with:
PHP Code:
//Forum info
$forums=$DB_site->query('SELECT forum.*,icon.title as icontitle,icon.iconpath as iconpath FROM forum 
LEFT JOIN icon
ON (forum.lasticon=icon.iconid)
WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder'
); 
File: FORUM/forumdisplay.php
Find:
PHP Code:
           if (strlen($forum['lastthread']) > $maxchars) {
              
$forum['lastthread'] = substr($forum['lastthread'], 0$maxchars-2) . '...';
            } 
Add after that:
PHP Code:
            if ($forum['lasticon']) {
              
$icon="<img src=\"$forum[iconpath]\" alt=\"$forum[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
            } else {
              
$icon="";
            } 
Find:
PHP Code:
//Forum info
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder'); 
Replace with:
PHP Code:
//Forum info
$forums=$DB_site->query('SELECT forum.*,icon.title as icontitle,icon.iconpath as iconpath FROM forum 
LEFT JOIN icon
ON (forum.lasticon=icon.iconid)
WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder'
); 
File: FORUM/newthread.php
Find:
PHP Code:
      //create new thread
      
if ($postpoll) {
         
$visible 0;
         
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($subject))."' WHERE forumid IN ($foruminfo[parentlist])");
      } 
Replace with:
PHP Code:
      //create new thread
      
if ($postpoll) {
         
$visible 0;
         
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($subject))."',lasticon=$iconid WHERE forumid IN ($foruminfo[parentlist])");
      } 
Find:
PHP Code:
      // update forum stuff
      
if ($visible==1) {
        
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1,lastpost='".time()."',lastthread='".addslashes(htmlspecialchars($subject))."',lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
      } 
Replace with:
PHP Code:
      // update forum stuff
      
if ($visible==1) {
        
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1,lastpost='".time()."',lastthread='".addslashes(htmlspecialchars($subject))."',lasticon=$iconid,lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
      } 
File: FORUM/reply.php
Find:
PHP Code:
      // update forum stuff
      
if ($visible==1) {
        
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1,lastpost='".time()."',lastthread='".addslashes(htmlspecialchars($subject))."',lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
      } 
Replace with:
PHP Code:
      // update forum stuff
      
if ($visible==1) {
        
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1,lastpost='".time()."',lastthread='".addslashes(htmlspecialchars($subject))."',lasticon=$iconid,lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
      } 
File: FORUM/editpost.php
Find:
PHP Code:
  if ($isfirst and $title!="" and $postinfo[dateline]+$editthreadtitlelimit*60>time()) {
    
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."', iconid=".intval($iconid)." WHERE threadid=$threadinfo[threadid]");
    
$lastpost=$DB_site->query_first("SELECT * FROM forum WHERE forumid=$threadinfo[forumid]");
    if(
$lastpost['lastpost']==$threadinfo['dateline']) {
      
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($title))."' WHERE forumid=$threadinfo[forumid]");
    }
  } 
Replace with:
PHP Code:
  if ($isfirst and $title!="" and $postinfo[dateline]+$editthreadtitlelimit*60>time()) {
    
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."', iconid=".intval($iconid)." WHERE threadid=$threadinfo[threadid]");
    
$lastpost=$DB_site->query_first("SELECT * FROM forum WHERE forumid=$threadinfo[forumid]");
    if(
$lastpost['lastpost']==$threadinfo['dateline']) {
      
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($title))."',lasticon=$iconid WHERE forumid=$threadinfo[forumid]");
    }
  } 
File: FORUM/postings.php
Find:
PHP Code:
  $lastpost=$DB_site->query_first("SELECT * FROM forum WHERE forumid='$threadinfo[forumid]'");
  if(
$lastpost['lastpost']==$threadinfo['dateline']) {
    
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($title))."' WHERE forumid='$threadinfo[forumid]'");
  } 
Replace with:
PHP Code:
  $lastpost=$DB_site->query_first("SELECT * FROM forum WHERE forumid='$threadinfo[forumid]'");
  if(
$lastpost['lastpost']==$threadinfo['dateline']) {
    
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($title))."' WHERE forumid='$threadinfo[forumid]'");
  } 
Template: forumhome_lastpostby
Find:
Code:
<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lastthread]</a>
Change to:
Code:
$icon <a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lastthread]</a>
It works however updating the forums in the admin cp is very slow. Could someone tell me how to fix this?
Reply With Quote
  #274  
Old 09-27-2002, 09:49 AM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If i could find your file

its slow as your adding an extra query per forum so when it tries to update them it will take ages.
Reply With Quote
  #275  
Old 09-28-2002, 04:21 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i noticed another bug. when i post a poll, it will not update the title on forumhome.
to fix it, open newthread.php and find:
Code:
      //create new thread
      if ($postpoll) {
         $visible = 0;
replace it with:
Code:
      //create new thread
      if ($postpoll) {
         $visible = 0;
         $DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($subject))."' WHERE forumid IN ($foruminfo[parentlist])");
download the full 2.2.8 update here.
Reply With Quote
  #276  
Old 09-28-2002, 08:35 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Question: How many queries does this add to forumhome?
Reply With Quote
  #277  
Old 09-28-2002, 09:19 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

none. that's why i install it.
my goal on my board is to have a low query number, is the most important for the speed and performance of the site.
Reply With Quote
  #278  
Old 09-28-2002, 09:32 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's my goal too! Is there a way I can contact you via MSN or AIM? I'd love to know, if it's ok with you how you keep your queries down...

I'm glad this doesn't add ANY queries at all!

I need some help cutting queries down in some files..
Reply With Quote
  #279  
Old 09-29-2002, 12:48 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry, i dont do support over IM's. that's why we have forums.
Reply With Quote
  #280  
Old 09-29-2002, 01:27 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'll find that as long as you dont go adding too many features or the author provides a way to combine queries you will have efficent code.

But please dont think that more queries means a slower execution time, it all depends on how big the table is, indexes, how many tables there is and what your scanning for.
Reply With Quote
  #281  
Old 09-29-2002, 07:13 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, well on my proper forums right now, I went over the top with hacks [60+ of them] and it slowed the forums down, had 46 queries on forumhome etc..
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06234 seconds
  • Memory Usage 2,409KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (27)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete