Need an opinion about something

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zurih
    Member
    • Oct 2004
    • 75

    Need an opinion about something

    Hi, I'm trying to add in forumhome, latest threads included text.
    There is a hack in vb.org that does this, but couple of members suggested that it makes the server to be overloaded if many users are logged in the same time because its performs full table scans. the suggestion was to put a time/date limit in the query - but no one updated the instruction.

    I got no answer over there so please help me if you can.

    I just want that someone will look at the code and to tell if there really is that kind of problem.

    here is the full code:

    PHP Code:
    $forumperms = array();
    foreach(
    $forumcache AS $forum) {

        
    $forumperms["$forum[forumid]"] = fetch_permissions($forum['forumid']);

        
    // ## HIDE FORUMS WITHOUT THE CANVIEW OR CANVIEWOTHERS PERMISSION ##
        
    if (!($forumperms["$forum[forumid]"] & CANVIEW) || !($forumperms["$forum[forumid]"] & CANVIEWOTHERS)) {
            
    $limitfids .= ','.$forum['forumid'];
        }
    }
    unset(
    $forum);

    if (
    $vboptions['threadpreview'] > 0) {
        
    $previewfield ', post.pagetext AS preview';
        
    $previewjoin 'LEFT JOIN '.TABLE_PREFIX.'post AS post ON(post.postid = thread.firstpostid)';
    }

    $getthreads $DB_site->query("
        ## GET LATEST THREADS ##
        SELECT pagetext, thread.*,thread.iconid AS threadiconid 
    $previewfield
        FROM "
    .TABLE_PREFIX."thread AS thread
        LEFT JOIN "
    .TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
        
    $previewjoin
        WHERE open = '1'
        AND forumid NOT IN (0
    $limitfids)
        AND thread.visible = '1'
        AND deletionlog.primaryid IS NULL
        ORDER BY lastpost
        DESC LIMIT 5"
    );

        while(
    $thread $DB_site->fetch_array($getthreads)) {

        
    $threads true;
        
    $thread['message'] = parse_bbcode2($thread['pagetext'], 0011);
        if (
    strlen($thread['message']) > 500)
        {
        
    $tobecontinued '... <a href="' $vboptions[bburl] . '/showthread.php?t=' $thread[threadid] . '">äîùê ì÷øåà</a>';
        
    $thread['message'] = substr($thread['message'], 0500).$tobecontinued;}
        
    $thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspecialchars($thread['title']), 68));
        
    $thread['date'] = vbdate($vboptions['dateformat'], $thread['lastpost'], 1);
        
    $thread['time'] = vbdate($vboptions['timeformat'], $thread['lastpost']);
        
    $thread['replycount'] = vb_number_format($thread['replycount']);

        
    // show goto new post
        
    $show['firstnew'] = false;
        
    $bbforumview fetch_bbarray_cookie('forum_view'$thread['forumid']);

        if (
    $bbforumview $bbuserinfo['lastvisit']) {
            
    $lastread $bbforumview;
        } else {
            
    $lastread $bbuserinfo['lastvisit'];
        }

        if (
    $thread['lastpost'] > $lastread) {

            
    $threadview fetch_bbarray_cookie('thread_lastview'$thread['threadid']);

            if (
    $thread['lastpost'] > $threadview) {
                
    $show['firstnew'] = true;
                
    $show['icon'] = false;
            }
        }

        
    exec_switch_bg();

        eval(
    "\$threadbits .= \"".fetch_template('forumhome_latestthreadbit')."\";");
    }
    if (
    $threads) {
        
    $show['latestthreads'] = true;
    }
    // memory saving
    unset($thread$threads);
    $DB_site->free_result($getthreads); 
    Also, I would also like to add the forum names that the threads are in.

    Any help would be really appreciated.

    Thanks
    Last edited by zurih; Wed 12 Jan '05, 4:37am.
  • Zachery
    Former vBulletin Support
    • Jul 2002
    • 59097

    #2
    We cannot provide any support or help for 3rd party scripts or code, sorry that you did not get a response right away at vBulletin.org but understand the poeple that support these hacks do it in their free time and might not get back to you within 24 hours all the time.

    Comment

    • zurih
      Member
      • Oct 2004
      • 75

      #3
      yes i understand this.
      maybe someone can help here. thats the reason i posted here.
      I just need that the latest threads will be pulled from last X days\hours because otherwise from what i understant it creates server overload.

      Comment

      • Dennis Olson
        Senior Member
        • Oct 2002
        • 2789

        #4
        How busy is your forum?

        Comment

        • zurih
          Member
          • Oct 2004
          • 75

          #5
          in a busy time of the day I have 300-350 users online..
          51908 members, 23262 threads and 126468 posts.

          Comment

          • Dennis Olson
            Senior Member
            • Oct 2002
            • 2789

            #6
            My personal recommendation would be to NOT attempt the modification. I also have a very busy forum, and know how performance can take a big hit. JMHO....

            Comment

            • zurih
              Member
              • Oct 2004
              • 75

              #7
              in this condition i also thing its not recommended, but as i heard there is a way to search the latest threads just from the last x days\hours.
              with this i will have no problem

              Comment

              • Dennis Olson
                Senior Member
                • Oct 2002
                • 2789

                #8
                Well, you can look in the SEARCH.PHP or the SEARCH template for the code in ADVANCED SEARCH to specify a time-frame. You could then incorporate that code into your project.

                Comment

                • zurih
                  Member
                  • Oct 2004
                  • 75

                  #9
                  take a look at this
                  This is a discussion forum powered by vBulletin. To find out about vBulletin, go to http://www.vbulletin.com/ .

                  this is what i want.

                  Comment

                  • Dennis Olson
                    Senior Member
                    • Oct 2002
                    • 2789

                    #10
                    Yes, I understand your requirement. The code to select a time-frame for SEARCHes is included in the Advanced Search option code in either SEARCH.PHP or the SEARCH template. All you should have to do is copy/paste that code into your application.

                    Comment

                    • Steve Machol
                      Former Customer Support Manager
                      • Jul 2000
                      • 154488

                      #11
                      Please do not discuss code modifications on these forums. The proper place for this in at vbulletin.org. Thank you for respecting this.
                      Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                      Change CKEditor Colors to Match Style (for 4.1.4 and above)

                      Steve Machol Photography


                      Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                      Comment

                      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                      Working...