No announcement yet.

Curious logic in upgrade step 143 for 500a1

  • Filter
  • Time
  • Show
Clear All
new posts

  • Curious logic in upgrade step 143 for 500a1

    Hello, we noticed after a forum upgrade from version 3, we were missing almost 70K threads. We tracked it down to this particular upgrade step in 500a1.

    PHP Code:
    function step_143()
    This step removes duff thread records that have no first postid.
    These threads have no posts, so adding them would be pointless and cause issues down the line.
    Exclude the threads with open == 10 which are thread redirects
    $query "
    TABLE_PREFIX "thread
    WHERE firstpostid = 0 AND open <> 10
    sprintf($this->phrase['vbphrase']['update_table'], 'thread'), $query

    The code comment says "open == 10", but the actual query uses the '<>' or 'NOT equal to' operator.
    The result is that almost 70k threads were deleted. These threads did not have any posts other than the starter, but they should not just be deleted from the upgraded forum.

    We would like to confirm that the correct query should be "AND open = 10".

  • #2
    These are threads with no posts. All threads have to have at least one post to actually be a thread. The firstpostid refers to the starter post.

    The query is selecting the opposite of open == 10. <> means not equal. So your change to the query will do the exact opposite of what it is supposed to do.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API


    • southstar86
      southstar86 commented
      Editing a comment
      I did NOT change the query. That's why I brought this up. That is the source code in that file.

      When looking at these threads with firstpostid of 0 in vb 3.8, they are real threads with no replies. They shouldn't be deleted on upgrade.

    • Wayne Luke
      Wayne Luke commented
      Editing a comment
      If a thread doesn't have a firstpostid, it would not have any content within a default installation of vBulletin 3 or 4. The thread table does not store any post information.

      We would need to examine a copy of the database to determine if legitimate threads are being deleted. Any thread with a firstpostid of 0 is not considered legitimate.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.