vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=137675

CES Intelligent Attachment Query
by thincom2000
27 Jan 2007 19:53

1 Attachment(s)
CES Intelligent Attachment Query
Version: 1.3.0

Version 1.3.0 has no real changes other than now being a product. Now requires CES Pre-Process Hooks.

*** NEWS ***
3/25/2007 - v1.3.0 (product version) released
------------------------------------------------------
1/28/2007 - v3.0.0 released
1/27/2007 - v1.0.0, v2.0.0, v2.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

What It Does:
Normally showthread wastes a query on attachments by checking if the thread has an attachment in any post, not bothering to check if that post and attachment are even on the current page, then querying for the page's posts. This hack removes a potentially unnecessary query from showthread.php by joining queries.

I hope someone from Jelsoft sees this thread.

Mod Features:
- removes 1 pointless query

Products to Install: 1
Plugins Included: 2
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.3.0:
- only 1 file edit
- requires CES Pre-Process Hooks
- uses vBulletin's Plugin system
- changed version numbering (confusion!)

Gizmo5h1t3 27 Jan 2007 20:18

saved a copy of showthread, edited it, and copied over.....
least the boards still running....cant say ive noticed the saved query tho??

thincom2000 27 Jan 2007 20:32

The query is only saved if there is an attachment anywhere in the thread and not on the page.
vBulletin by default will make a query in that situation.

So in normal forum/showthread use, you would not notice a drop in queries.

thincom2000 27 Jan 2007 21:53

I uploaded version 2.0 which completely eliminates 1 query from showthread.php (even on the pages with attachments) if there is an attachment somewhere in the thread.

Kiros72 28 Jan 2007 20:53

Forgive my stupidity, but I have to wonder if the one-less query makes up for all the new commands processed in showthread... :confused:

Get Shorty 28 Jan 2007 22:39

I get errors:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I'm also using your other modifcation to showthread, fyi.

This was a thread that didn't have any attachments.

I've reverted back for now.

Get Shorty 28 Jan 2007 22:42

1 Attachment(s)
Here is the code that I was using... See anything wrong?

Attachment 59649

thincom2000 28 Jan 2007 23:40

It's because there's a comma missing. This problem was fixed in version 3.0.0.

thincom2000 28 Jan 2007 23:42

Quote:

Originally Posted by Kiros72 (Post 1169239)
Forgive my stupidity, but I have to wonder if the one-less query makes up for all the new commands processed in showthread... :confused:

Queries are VERY slow. Code is usually better.

Get Shorty 29 Jan 2007 00:56

Trying again... I'll post back with my results in a bit.

Get Shorty 29 Jan 2007 01:11

Everything seemed to work, except for one problem. All of the current attachments showed up as "attachments pending approval".

Reverted back to normal for now...

thincom2000 29 Jan 2007 11:18

This should not be happening... I'll look into it later today.

Do you have usergroups who need attachment moderation? Because I can't even figure out how to set that.

Get Shorty 29 Jan 2007 13:17

No. Anyone can post attachments without moderation, excluding guests. The forum was restricted to certain usergroups. I didn't check in the open forums... whoops

thincom2000 29 Jan 2007 23:00

Okay, this was caused by a typo I made in the 3.0 install file (that I didn't make in my test which is why I didn't understand the problem). Uploading the non-typo'd version now.

thincom2000 29 Jan 2007 23:07

Basically you need to find:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and change:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

to:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

That should fix your "all attachments are moderated" woes.

Not having this resulted in $attachment['visible'] being false, which class_postbit.php interpreted as the attachment requiring moderation to become visible.


All times are GMT. The time now is 17:41.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.