vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Show Thread Enhancements - CES Intelligent Postbit Query (https://vborg.vbsupport.ru/showthread.php?t=137711)

thincom2000 01-27-2007 10:00 PM

CES Intelligent Postbit Query
 
CES Intelligent Postbit Query
Version: 1.0.1

This hack is now used as a troubleshooting tool for members with unusually high queries on showthread. You do not need to install this unless your queries peak around 20 or higher.

Note that if after installing this you experience a drop in queries, it means you have a bad plugin installed. Leaving this installed, while this does not hurt your forum at all, does not solve your query problem - it only now hides it.

To disable the tool, you only need to change the line:
PHP Code:

$lastcheck = ($lastfetchtype == $fetchtype) ? true false

to:
PHP Code:

// $lastcheck = ($lastfetchtype == $fetchtype) ? true : false; 

Post your query success stories in the thread! :)

For those without success (i.e. it doesn't seem to make a difference), please don't uninstall, but help us determine what is different in your case. PHP version, MySQL version, hacks installed, PHP cache, etc. would all be useful information. Thanks!


*** NEWS ***
This section has become a list of bad plugins. Often these plugins can be optimized by a rewrite using a different hook, and thus not causing this query issue.

Product: Username Management
Hook Location: postbit_factory
Bad Plugin: Add Username history to postbit(legacy)

1/28/2007 - v1.0.0, v1.0.1 released

I actually came across this while trying to reduce queries in my CES Site News mod which uses a customized showthread.php.

Known Issues:
- NONE

- Some users see an amazing improvement, others do not see a difference in query count for some time, while still others don't see any difference at all. It all depends on your server setup and your current vBulletin installation (settings, other mods, etc). This hack is still young (1 day) so we haven't narrowed down what causes these differences in success.

- If you are still experiencing the stolen signatures issue, you need to clear your sig_cache. Do this by going to AdminCP -> Maintenance -> Update Counters -> Empty Signature Cache.

What It Does:
On some installations showthread wastes 1 query per post in showthread.php when creating the postbits. You can tell if this applies to your installation if you approach or exceed 20 queries on a page of only 10 or so posts.

By adding these 4 lines, showthread checks to see if it already has created the appropriate Postbit Factory object instead of doing it all over again. Queries on showthread are thus DRASTICALLY reduced (1 per post), even though the code reveals no direct database references.

This can be a HUGE performance boost.

I hope someone from Jelsoft sees this thread...

Mod Features:
- removes multiple pointless queries

Products to Install: 0
Plugins Included: 0
Files to Upload: 0
Files to Edit: 1
New Templates: 0
Template Edits: 0
Queries Added*: -1

*See "What It Does" for details.

*** Changelog ***
As of Version 1.0.1:
- fixed bug where posts would "steal" signatures from each other
Special thanks to TheFrienzNet for his help ^_^

winpro19 01-28-2007 03:56 AM

Yay first to reply and install!! THanks, trying it out now!

stwilson 01-28-2007 04:41 AM

In your instructions you mention to replace this line
Quote:

$postbit_obj =& $postbit_factory->fetch_postbit($fetchtype);
You do not mention to replace it twice. My showthread file has the above line listed in two different locations. Should I replace both of them with your suggested changes?

thincom2000 01-28-2007 04:55 AM

You can replace both if you want. The second instance of the line is for Hybrid / Threaded Modes which are the boring threadlists you sometimes get from search engines. If you don't have Hybrid / Threaded Mode enabled on your forum, changing that section of showthread.php is not necessary.

stwilson 01-28-2007 06:01 AM

Got it. Clicks installed.

thincom2000 01-28-2007 06:13 AM

If everyone could please post the number of queries they save on a full page of posts, that would be awesome.

Here's mine: 22 - 10 = 12.

lolo? 01-28-2007 06:37 AM

no change for me it's the same before and after :s

thincom2000 01-28-2007 06:38 AM

How many posts were in the thread? Link?

Also the page you are checking might still be cached in your browser. This doesn't happen much with regards to queries but happened to me a few times today.

puregraf 01-28-2007 10:39 AM

can this work with vb 3.5.4 ? I really need this.

thanks

winpro19 01-28-2007 11:06 AM

Hmm...this is probably a stupid question...but how do I determine the number of queries on my page? Let me know ,

Thanks guys

Darat 01-28-2007 11:27 AM

I've tried it on a page of default number of posts (40) - which generated 95 queries before and 95 queries afterwards.

So seems to have no effect. :(


By the way what is this line used for:

$lastfetchtype = ($lastfetchtype != $fetchtype) ? $fetchtype : $lastfetchtype;

You don't seem to make any reference to $lastfetchtype?

thincom2000 01-28-2007 01:37 PM

$lastfetchtype is a new string this adds to track what the last generated postbit was (i.e. a post, PM, etc.)

PHP Code:

$lastcheck = ($lastfetchtype == $fetchtype) ? true false;
$lastfetchtype = ($lastfetchtype != $fetchtype) ? $fetchtype $lastfetchtype

means:

If $lastfetchtype equals this $fetchtype, $lastcheck equals true, otherwise $lastcheck equals false.
Now that we know what $lastfetchtype is, we can bother changing it. If $lastfetchtype is not the same as this $fetchtype, update it, otherwise leave it alone.

There should be no need to reference $lastfetchtype.

Are you using Linear or Hybrid / Threaded Modes on your forum?

EDIT: Here's some screenshots to show this actually did something for me. I'm really clueless as to why it wouldn't work for others. I'll restore my backup showthread and check it out.

EDIT: I restored my backup and tried it again. No problems. Note that the line

PHP Code:

$postbit_obj =& $postbit_factory->fetch_postbit($fetchtype); 

appears twice in showthread (line 1046 and line 1507), and for the most part we are only modifying the first appearance. If you are experiencing problems, try changing it at both places

thincom2000 01-28-2007 02:33 PM

Quote:

Originally Posted by winpro19 (Post 1168912)
Hmm...this is probably a stupid question...but how do I determine the number of queries on my page? Let me know ,

Thanks guys

I'm actually wondering this too. Since I already have it enabled, can't find the setting now, and will be wanting to disable it in the future.

EDIT: https://vborg.vbsupport.ru/showthread.php?t=82900

COBRAws 01-28-2007 03:03 PM

wow!

I had a thread with 101 posts, after doing this changes I had 136 queries, now I just have 35!
Good work mate. But, is there any problems doing these edits?

thincom2000 01-28-2007 03:08 PM

Shouldn't be any problems. Unless you have a page with different postbits:

like it shows PMs, and posts, and post-legacies on the same page,
but the $lastfetchtype check should eliminate those problems.

Glad to hear about that success that's an awesome reduction. Unless someone has issues where it actually messes up functionality, I'm hoping for a MOTM XD, or at least Jelsoft putting it in 3.7.x.

FleaBag 01-28-2007 04:17 PM

With 50 posts per page, this is going to make a huge difference! Thanks very much! Think I will make sure all my files are all current version before I proceed through! :)

TheFrienzNet 01-28-2007 04:40 PM

Wow, thanks!

*EDIT*

WOW! MY forum's performance is 10x times faster! I mean wow! This is just great!

Kiros72 01-28-2007 04:59 PM

This is probably a stupid question, but how would you go about finding out how many queries it used, what the server load is, etc?

thincom2000 01-28-2007 05:04 PM

See this post: https://vborg.vbsupport.ru/showpost....8&postcount=13

TheFrienzNet 01-28-2007 05:18 PM

I have a bug to report, this occurs from time to time.

As I have a big community with over 45,000+ posts, some posts are messed up.

Sometimes, a user's signature is different from his real signature. Like me, sometimes my signature is different from my real one and it shows a signature from another user.

Kiros72 01-28-2007 05:18 PM

Thanks - trying it out now :)

Edit:

I'm getting the same bug as well - signatures messing up.
I'm not exactly sure why but it seems that there's no difference. 10 queries per page with or without this hack (10 posts per page as well) - or at least that's what I'm getting from the Microstats.

thincom2000 01-28-2007 05:46 PM

I had sigs turned off on my forum while testing this yesterday so I didn't notice. I will look into this issue.

Quote:

Originally Posted by Kiros72
I'm not exactly sure why but it seems that there's no difference. 10 queries per page with or without this hack (10 posts per page as well) - or at least that's what I'm getting from the Microstats.

A number of users have reported this just to edit their post 20 minutes later saying how awesome the changes were. If you are getting 10 queries per page it sounds like it's working (without the hack on a 10 post page should be about 20 queries). Are you using a PHP cache?

TheFrienzNet 01-28-2007 05:54 PM

Thanks thincom2000, but could you do it fast? I know I sound like a jerk but there are over 9,000 signatures messed up and my higher ranked bosses will be mad at me..

*Edit*

I got it fixed! In order to fix it, you must do 'Empty Signature Cache' in Maintenance! Thincom2000, I guess you have to update the readme. :)

*ReEdit*

Okay, I did that 'Empty Signature cache' but it worked only for a few minutes, after that it got messed up again. At the meantime, I will change the line back to what it was and run that 'Empty Signature Cache' maintenance script. Thank you Thincom2000.

tanyeri24 01-28-2007 06:01 PM

I have this line twice:
$postbit_obj =& $postbit_factory->fetch_postbit($fetchtype);

Replace both like the lines in the .txt file?

TheFrienzNet 01-28-2007 06:03 PM

Quote:

Originally Posted by tanyeri24 (Post 1169177)
I have this line twice:
$postbit_obj =& $postbit_factory->fetch_postbit($fetchtype);


Replace both like the lines in the .txt file?

Yes, if you want. One line is for hybrid mode and the normal view, but it's better doing it anyways. However, it's bugged, your user's signatures will be messed up.

tanyeri24 01-28-2007 06:08 PM

Quote:

Originally Posted by TheFrienzNet (Post 1169181)
Yes, if you want. One line is for hybrid mode, but it's better doing it anyways. However, it's bugged, your user's signatures will be messed up.

Installed :up:

TheFrienzNet 01-28-2007 06:09 PM

You will experience a few bugs with users signatures. So I don't recommend it, yet.

thincom2000 01-28-2007 06:21 PM

Just turned them back on and I am not experiencing any issues with my user's signatures.

Looks like I'm going to need more info from you guys. What usergroups are experiencing this problem? What permissions do they have? Do you have any sig-modifying hacks installed? Where signatures messed up on new posts or old ones?

Kiros72 01-28-2007 06:37 PM

From what I can tell, if this affects one usergroup, it should affect them all, however, I first noticed it with Registered Users. I'm not certain if anyone else is being effected because I had to revert the changes - users were starting to complain about how someone "stole" their signature.

The Registered Users have set signature permissions as follows:

Can Use Signatures: Yes
Maximum Characters in Signature Including BBCode Markup: 550
Maximum Characters in Signature Excluding BBCode Markup: 450
Maximum Lines in Signature: 8
Allow BB Code: Yes
Allow Basic BBCode: Yes
Allow Color BBCode: Yes
Allow Size BBCode: Yes
Maximum Value of x for SIZE=x BBCode: 5
Allow Font BBCode: Yes
Allow Alignment BBCode: Yes
Allow List BBCode: Yes
Allow Link BBCode: Yes
Allow Code BBCode: Yes
Allow PHP BBCode: No
Allow HTML BBCode: No
Allow Quote BBCode: Yes
Allow IMG Code: Yes
Maximum Number of Images in Signature: 8
Allow Smilies: Yes
Allow HTML: No

The only signature hack that I have is one that modifies the modifysignature template. If I'm thinking clearly, that only modifies the UserCP "Edit Signature" jazz. The hack that I have for it is the "Custom Sig Permissions Display" - for reference.

The first time I noticed this bug was at the first post of a thread - the first poster's signature was copied to the second poster's signature area. It was a total overwrite, not an addition. I looked to see if that was consistent, however, I didn't come across another instance like it before I went to revert the file.

Edit:

Also, I think you might have to have several members and several posts in a thread for this bug to appear - just a guess.

Edit 2:

As a note, I've had the file reverted for about 15 minutes (at least) and I'm still getting only 10 queries on a thread with 10 posts per page. I'm not sure this hack had an effect or not. :?

jedisct1 01-28-2007 06:44 PM

Hello,

It seems to mess signatures. After installing this, some posts had the signature of another user.
Reverting the patch fixed it.

Jorrit787 01-28-2007 06:45 PM

* Clicks uninstall.

I'm having the same problem with the signatures :(

iardon 01-28-2007 06:49 PM

Quote:

Originally Posted by thincom2000 (Post 1169051)
...or at least Jelsoft putting it in 3.7.x.

Have you contacted Jelsoft about this and your other CES mod?

TheFrienzNet 01-28-2007 07:00 PM

thincom2000, do you have MSN or any instant messenger so we can resolve this problem together?

tanyeri24 01-28-2007 08:04 PM

:( I have the signature problem too..

TheFrienzNet 01-28-2007 08:30 PM

We finally got it working! Please look at the first post.

tanyeri24 01-28-2007 08:36 PM

Quote:

Originally Posted by TheFrienzNet (Post 1169259)
We finally got it working! Please look at the first post.

where changes? :o

thincom2000 01-28-2007 08:42 PM

I just uploaded the updated instructions.

Very soon I will be off to eliminate the next unnecessary query: did you ever notice that polls add 2 extra queries to showthread? It'll take some, not hacking but, butchering, but I will do it with 0!

Also coming soon an updated version of my intelligent attachment query, that's basically no different in practice just fewer edits to showthread.php (since it was another butcher job).

tanyeri24 01-28-2007 08:44 PM

and now again edited but I have anyways same query count like unedited showthread.php .. (I see the querys with microstat plugin)

TheFrienzNet 01-28-2007 08:48 PM

Do you have any other page compressor/cache accelerator or whatsoever?

thincom2000 01-28-2007 08:48 PM

What's the query count?


All times are GMT. The time now is 05:12 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.01327 seconds
  • Memory Usage 1,840KB
  • 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
  • (7)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
  • (40)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