Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Beta Releases
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools
Detailed Latest Discussions in What's Going On Details »»
Detailed Latest Discussions in What's Going On
Version: 1.00, by Albus Albus is offline
Developer Last Online: Mar 2007 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 05-15-2004 Last Update: Never Installs: 8
Is in Beta Stage  
No support by the author.

Below is my first attempt at creating a hack. It works perfectly on my board but as no others have tested it, I am putting it here for now. I know there are other latest x posts type hacks around, however, in my day long search of this forum, I have yet to find one that suited my needs. Therefore, I wrote my own. I offer it here. It only uses one query to return information on the last x posts including the fields (forum id, forum title, thread id, thread title, initial poster id, initial poster name, last poster id, last poster name, reply count and views). It takes into account permissions using the CANVIEW and CANVIEWOTHERS constants and properly flags the show variable if no rows are deemed showable. Have fun and please do not hesitate to comment on this. This code is entirely of my own writing although it was visually inspired by the hack in place on http://cosforums.com. Thanks.

Show Your Support

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

Comments
  #32  
Old 05-24-2004, 04:50 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The code still does a full thread table scan - so this will cause server load problems on a large site. Just letting people know. Not a problem with small sites.
Reply With Quote
  #33  
Old 05-24-2004, 05:08 AM
Albus Albus is offline
 
Join Date: May 2004
Location: USA
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For those who did not understand that, let me elaborate. In a simple one table query you could select x last rows, which would not require the database server to actually 'look' at each row in the table to see if it met your criteria. That's a partial scan. In this hacks case, several tables are linked through join clauses andsome conditionals. This requires the database to scan the full table looking for sets of records that meet the search criteria, and finally get the last x rows. Now, ifyou are with us (Erwin and I) so far, here's why the script even bothers with a limit. With or without the limit, the database will initially do almost as much work, the difference is during transmission time, when the database sends the data back to the calling app (php page in this case). All that data is transmitted via the network. If we limit the data before it's sent, it means less network traffic, sure, but the relative hit on server-side performance is about the same. What Erwin says is true however. Unfortunately, in developing a general use hack, there are some sacrifices we must make in order to make it useful to the most people and trust that those with larger boards have also been around long enough to tailor a hack if required.



That was more than I intended on posting...oh well.
Reply With Quote
  #34  
Old 05-24-2004, 05:45 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can it be fixed to satisfy both large and small sites?
Reply With Quote
  #35  
Old 05-24-2004, 12:32 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not really. At least, not without adding new columns and queries, and making it work like lastpost - basically caching the latest post info.
Reply With Quote
  #36  
Old 05-24-2004, 05:14 PM
Albus Albus is offline
 
Join Date: May 2004
Location: USA
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It could be re-written to do most of the work in the php script. Write an sql statment that returns the last x (50 or so only) threads period. Then, in the php code, make the loop test the thread for perms first to avoid any extra processing time, then simply write a few small queries that get the extra info, like forum info, post info, and deletionlog info. The key here being simple queries with no joins. This would mean more, but less intensive db hits. If you have your display limit set to a small amount, like 8 or 10, then it shouldn't be too bad as your only getting the data you need when you need it. If you interested in this, I'll write an alternate version and you can test the efficiency of it.
Reply With Quote
  #37  
Old 05-24-2004, 05:34 PM
Albus Albus is offline
 
Join Date: May 2004
Location: USA
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

On second look Erwins solution is better. The first real check in this hack is for permissions which uses the forum id. That being the case, displayed or not, that is at least two more queries per row returned by my example above to get the forum id. I'll look into this further.
Reply With Quote
  #38  
Old 05-25-2004, 11:52 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Serenarules
On second look Erwins solution is better. The first real check in this hack is for permissions which uses the forum id. That being the case, displayed or not, that is at least two more queries per row returned by my example above to get the forum id. I'll look into this further.
I just had a look at your site - your style is awesome. Well done!
Reply With Quote
  #39  
Old 05-25-2004, 05:59 PM
Albus Albus is offline
 
Join Date: May 2004
Location: USA
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Many thanks!
Reply With Quote
  #40  
Old 05-26-2004, 06:34 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've figured out a way to pull the latest post from each forum and place it anywhere on the forumhome - without adding any new queries at all - but it does not work like a normal latest thread box as multiple threads in the same forum will not show up - only the latest one would. This is because only the lastpost is cached for each forum. I'll play around with it...
Reply With Quote
  #41  
Old 05-26-2004, 06:35 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Serenarules
On second look Erwins solution is better. The first real check in this hack is for permissions which uses the forum id. That being the case, displayed or not, that is at least two more queries per row returned by my example above to get the forum id. I'll look into this further.
My version of this hack hardcoded the permissions. Which saves on database queries. I just excluded certain forums in the actual query itself. Not as elegant, but works.
Reply With Quote
 


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 06:27 PM.


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.04106 seconds
  • Memory Usage 2,300KB
  • 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
  • (2)bbcode_quote
  • (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
  • (3)pagenav_pagelink
  • (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