DB Error Moderating Attachements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bill Rini
    Member
    • Sep 2010
    • 53

    [Forum] DB Error Moderating Attachements

    After upgrading to 4.1.6 I have started to receive db errors when I attempt to approve pictures users have uploaded. I get the following:

    Code:
    Database error in vBulletin 4.1.6:
    
    Invalid SQL:
    
                   SELECT a.attachmentid, a.contentid
                   FROM attachment as a
                   WHERE a.attachmentid IN (117223,117224,117225,117226,117227)
                           AND a.contenttypeid = 8;
    
    MySQL Error   : Table 'XXXXXX.attachment' doesn't exist
    Error Number  : 1146
    Request Date  : Tuesday, September 27th 2011 @ 10:58:22 AM
    Error Date    : Tuesday, September 27th 2011 @ 10:58:22 AM
    Script        : [URL="http://www.thailandfriends.com/modcp/moderate.php?do=doattachments"]http://www.XXXXXXXXXXX/modcp/moderate.php?do=doattachments[/URL]
    Referrer      : [URL="http://www.thailandfriends.com/modcp/moderate.php?do=attachments"]http://www.XXXXXXXX/modcp/moderate.php?do=attachments[/URL]
    IP Address    : XXXXXXXXX
    Username      : XXXXXXX
    Classname     : vB_Database
    MySQL Version : 5.1.56
    I've X'd out sensitive info but as you can see, the moderate.php script is attempting to do a SELECT on table XXXXXX.attachment. The only problem is that all of my tables have "vb_" as the table prefix. so it should be "FROM vb_attachment as a".

    I am able to approve the images but I get this error after the update. I assume it is when it re-queries the db for items not yet moderated.

    Just curious if this is a bug in the new 4.1.6 code or if I messed up doing the upgrade. I did a version check in Diagnostics and it reports no errors for anything in the modcp directory where the moderate.php file is located.
    Community manager at Thailand Friends
  • Lynne
    Former vBulletin Support
    • Oct 2004
    • 26255

    #2
    This looks like a bug. I can find the query in moderate.php around line 994. http://tracker.vbulletin.com/browse/VBIV-12825 I think you can just make this change to that query:

    PHP Code:
            //Fetchs only contentid from attachments that are album pictures
            
    $pictures $db->query_read_slave($sql "
            SELECT a.attachmentid, a.contentid
            FROM " 
    TABLE_PREFIX "attachment as a
            WHERE a.attachmentid IN (" 
    implode(','array_keys($attachments)) . ")
                AND a.contenttypeid = 
    $contenttypeid
            "
    ); 

    Please don't PM or VM me for support - I only help out in the threads.
    vBulletin Manual & vBulletin 4.0 Code Documentation (API)
    Want help modifying your vbulletin forum? Head on over to vbulletin.org
    If I post CSS and you don't know where it goes, throw it into the additional.css template.

    W3Schools <- awesome site for html/css help

    Comment

    • Bill Rini
      Member
      • Sep 2010
      • 53

      #3
      Originally posted by Lynne
      This looks like a bug. I can find the query in moderate.php around line 994. http://tracker.vbulletin.com/browse/VBIV-12825 I think you can just make this change to that query:

      PHP Code:
              //Fetchs only contentid from attachments that are album pictures
              
      $pictures $db->query_read_slave($sql "
              SELECT a.attachmentid, a.contentid
              FROM " 
      TABLE_PREFIX "attachment as a
              WHERE a.attachmentid IN (" 
      implode(','array_keys($attachments)) . ")
                  AND a.contenttypeid = 
      $contenttypeid
              "
      ); 
      Thanks. That was it.
      Community manager at Thailand Friends

      Comment

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