Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Thread visibility
Avatar
Bill Murray
Member
Free Members
sp_UserOfflineSmall Offline
Dec 1, 2011 - 10:02 pm

I'm not sure if this is subject to configuration, but ...

On this forum, a thread with only 1 post that is subject to moderation shows up in the thread list, but clicking on it won't show the post, since it is still subject to moderation.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 1, 2011 - 10:09 pm

yes it would. and we did used to do that in 5.0... but that was the query that could bring some servers down including ours... 🙁

so we removed that 'feature' and are researching alternate ways to achieve the same... tougher problem than it sounds...

Avatar
BOZ
Member
Free Members
sp_UserOfflineSmall Offline
Dec 2, 2011 - 7:14 pm

Mr Papa said

yes it would. and we did used to do that in 5.0... but that was the query that could bring some servers down including ours... 🙁

so we removed that 'feature' and are researching alternate ways to achieve the same... tougher problem than it sounds...

I had the same question, but would like to offer to maybe tackle this one and am near ready to jump in to help coding if we can get me involved and up to speed on the process and what was happening with the previous version. I have a pretty heavy background in sql and may able to refine the calls.

I believe hiding post that need moderating are a top priority in spam prevention. Currently a new user can create a large number of posts with titles that show( unmoderated) in the forum that literally scrolls all legitimate content off the presentation page and can even bury "real" posts several pages deep, fully defeating all spam prevention you have in place elsewhere.

I realize Im late to the game,but Im ready to jump in to help not just complain.

BOZ

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 2, 2011 - 8:11 pm

I will let Andy get back with you on the query in the AM (he's in UK)...

but posts in moderation will not show any post content... the issue is whether the topic (not content) shows in the group view and forum view last post columns...

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Dec 3, 2011 - 4:39 am

Morning BOZ

OK - here is the full story.

The Target:

Links to posts in moderation (from here on referred to as PIM) in such locations as Group View(i.e., front forum page)/Last Post or Forum View(i.e., Topic Listing)/First and Last Post columns, should only ever be shown to admins/moderators and to the user who made the post. This was the target.

This was achieved in Group View with very small overhead.

In Topic View (i.e., the posts themselves) there is no issue. If the current user can access the topic view then a PIM is shown. If they do not qualify to see the content then it simply says 'awaiting moderation'.

The problem is with the Forum View. If you were a visitor to this site over the last couple of of weeks you will have noticed it kept dropping out. This was partly due to the main Forum View query.

Our Queries:

It has been a major goal of V5 to dramatically reduce the number of select queries being run and in that aim we like to think we have been somewhat successful - reducing some views by as much as 75% or more. So we wanted to try and achieve this target development with as little impact as possible on number of queries needed to satisfy the requirements.

The Problem:

The problem lies with selecting the post to satisfy the last post column of forum view. And, if a new topic with a single PIM, then the first post column as well. Under normal circumstances we can find the first post in a topic by the post_index column (in the sfposts table) where it equals 1. This column, you will realise, is a denormalised and 'manually' maintained column simply there to allow us to make shortcuts. The last post column can be satisfied by the post_id held in the topic record itself which always records the last post id made in that topic.

But we also need to test the post records in question to see if that post is a PIM - which is held in the column post_status of the sfpost record. If it equals >0 then it is a PIM. (1 is a standard PIM, 2 is a PIM also been marked as spam by AKismet).

Then it gets complicated! If a PIM then we also need to test it against the current user viewing the forum view page. If they are a forum admin or moderator then there is nothing to do. We use the PIM. If the current user is a member and their user_id matches the user who made the post - then we use the PIM record. If the current user is a guest and their guest_email matches the email address of the guest who made the post then again - we use the PIM record.

But if all of those tests fail then we need to select an earlier post in the topic and basically run the tests again. If the topic has just the one post then it will be excluded from the forum view topic listing.

I hope that all makes some sort of sense!

The Result:

On a system with a large number of topics - like ours here - then chaos. Basically it chewed up SQL resources and ground the whole site to a halt. Run locally on my test systems using something like MySQL Workbench it appeared to be OK but get it on a live site and....

SQL Solutions:

It could be done by breaking the main query down into more discreet queries but I am trying to avoid that where possible - or at least to minimise this approach. Maybe a SQL guru could solve the problem and I welcome anyone willing to take a look at it.

Before reading the next bit - assuming you have got this far! - remember that simply either showing PIMs to everyone or not showing them at all are far simpler SQL solutions.

Operational Solutions:

There is another approach to this whole situation that we are considering and this involves bringing forward a development we were planning for the future. This entails a simple user notification system. In this scenario a PIM is never shown to a member or to a guest. Nice and simple. The problem, of course, is the member who made the post can not now find it while in PIM status.

Enter the notification system. Basically we would instead display a simple notice somewhere on the screen to say that their post was still a PIM and also give a link to the topic.

This approach has several advantages:

  1. It removes the stress from the underlying Group and Forum view queries altogether.
  2. It actually makes it easier for the end user to determine their post is still a PIM without them having to hunt for it.
  3. It allows us to put in place a sub-system we have been wanting to do (just not originally planned for V5.0) that can be used for other notifications such as deleted posts and moved posts/topics.
  4. It provides an api for plugins that could also make use of the sub-system for other notifications.

In some respects this could be seen as ducking the issue but the advantages are worth consideration.

Finally:

If you want to take a look at the query in question then you will see it in the /forum/content/sp-forum-view-class.php file. The commented out code is the offending query. Please do take a look, ask questions etc., as I would love to solve if of course. I can give you a quick, easy and 'dirty' method to run the query and get a copy of the actual sql being used. Just remember that if run when logged in as an admin then the query is simple. It is as a member or guest that it gets complex. And yes - the main problem is that sub-query!

Helping Out or Joining the Team:

I can't stress enough how much we would welcome extra team members. If you are seriously interested send us a PM and we can discuss it off line.

And I hope the above makes sense!

Andy

andy-signature.png
YELLOW
SWORDFISH
Avatar
BOZ
Member
Free Members
sp_UserOfflineSmall Offline
Dec 4, 2011 - 2:59 pm

Wow, um , this isnt going to go well. After having dived into the queries there is very little that can be done to "make them more efficient" They really are quite a bear with that said. I think your alternate solution of separate notification is going to have to be the answer, with a 6.0 target being an overhaul of the data structure undercarriage. The initial structure of the data needs a better layout for scalability, Id imagine that is what some of your server issues really are, because the current data structure is not scalable in any means really, bigger is going to be much slower no matter what with the current data structure, but I expect you already know that.

With that said I do have a few tricks I am trying in some custom functions that I will try to refine and see if it gives any relief.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Dec 4, 2011 - 3:29 pm

Let's take this off-line as I would like to discuss this in more depth if that is OK with you... I will email you

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 617
Members: 17359
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10125
Posts: 79620