Announcement

Collapse
No announcement yet.

How to fix refcount for old attachments in database vBulletin 5.5.4

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to fix refcount for old attachments in database vBulletin 5.5.4

    Hello. Is it possible to fix old attachments in vBulletin 5.5.4?

    A bit of history:
    At the beginning of the year, I converted the forum from Phorum to vBulletin 5, since then the forum has been running with the cleanup_2 task turned off, because if I turn it on, old attachments are deleted


    My question is:
    I found a solution to fix this problem in vBulletin 4

    Code:
    UPDATE filedata
    LEFT JOIN (
       SELECT filedataid, COUNT(attachmentid) AS actual
       FROM attachment
       GROUP BY filedataid
    ) list USING (filedataid)
    SET refcount = IFNULL(actual, 0)
    WHERE refcount <> IFNULL(actual, 0)

    How to change this query for vbulletin 5.5.4 Database?

    PHP 7.3.9
    MariaDB 10.3
    Last edited by elektro-kot; Sat 12th Oct '19, 4:01am.

  • #2
    The attachment table is now named attach. I don't know why the name changed. Other than that, the query should work.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud customization and demonstration site.
    vBulletin 5 Documentation - Updated every Friday. Report issues here.
    vBulletin 5 API - Full / Mobile
    I am not currently available for vB Messenger Chats.

    Comment


    • #3
      Originally posted by Wayne Luke View Post
      The attachment table is now named attach. Other than that, the query should work.
      Ok Wayne, thank you.

      But, what about the "attachmentid" column? It does not exist in the attach table...

      Comment

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