Database problems

So I installed the comment spam pack and now my php error logs are full of errors :

WordPress database error Table 'canalblogs.wp_3_avhfdas_ipcache' doesn't exist for query INSERT INTO wp_3_avhfdas_ipcache (ip, spam, added, lastseen) VALUES (INET_ATON('107.20.37.122'), 0, '2012-07-17 21:36:48', '2012-07-17 21:36:48') made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentyten/single.php'), get_header, do_action('get_header'), call_user_func_array, AVH_FDAS_Public->actionHandleMainAction, AVH_FDAS_DB->insertIP
[17-Jul-2012 22:37:56] WordPress database error Table 'canalblogs.wp_3_avhfdas_ipcache' doesn't exist for query SELECT * FROM wp_3_avhfdas_ipcache WHERE ip = INET_ATON('67.195.37.167') made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentyten/archive.php'), get_header, do_action('get_header'), call_user_func_array, AVH_FDAS_Public->actionHandleMainAction, AVH_FDAS_DB->getIP

Its network installed but I've not visted every blog - do I have to, or is this another badly hacked plugin?

  • Kimberly
    • Champion of Loops

    Hello Steve

    Its network installed but I've not visted every blog - do I have to, or is this another badly hacked plugin?

    This seems a bit unfair as we have no idea what the issue actually is. I am very sorry you are having trouble.

    So let's see if we can work it out before you decide to throw too many rocks at us? Please? :wink:

    Being that we've not seen a rash reporting of this error I am sure it can be explained.

    I'm going to ping the developer right away here, since he will definitely be the best person to ask about this affecting your setup in such a way.

    BEst,

    Kimberly

  • James Dunn
    • The Crimson Coder

    Good day @Steve Atty

    Until @KimberlyL gets the developer in here, I thought I'd chime in with a possibility. I have found many times that errors like this are usually (but now always) related to permissions problems. Occasionally, I find that this is caused because a table simply wasn't created to begin with. Who knows why the table doesn't get created, but that has happened. More often though, the table is created and the permissions given are not sufficient to give it write ability via WordPress.

    First, check to see if the table exists - use something like PHPMyAdmin (if you want, but I personally hate it), or grab Navicat and you'll be much happier.

    If the file exists, then try to change permissions and see if the errors go away. If they disappear and you are comfortable with the permissions given, then you should be golden until the developer that Kimberly referred to comes in.

    If none of this works, then you've lost nothing but a little bit of time because both of these are non-destructive potential solutions. Give it a shot and report back what you find.

    James Dunn
    Athens, GA USA

  • Steve Atty
    • Site Builder, Child of Zeus

    The problem is that the avh database calls to access the cache table use the blog specific table prefix ( wp_3_ for example) rather than the base table prefix (wp_) So the table is created in one blog when you network activate but when the code runs it expects to find the table in the current blog. I did a fix by editing the database access calls and changing it so it didn't put the blog specific prefix at the start of the table name

  • Steve Atty
    • Site Builder, Child of Zeus

    At home now so can dig into the code.

    The code that runs when the plugin is activated is:

    'CREATE TABLE "' . $wpdb->avhfdasipcache . '" (

    So if you are logged in on the root blog and using the Network Admin Dashboard then that creates the table in the root blog (so for my install that means its created wp_avhfdas_ipcache)

    The code that accesss the cache also uses $wpdb->avhfdasipcache which is fine as long as the spammer is spamming against the root blog. However if they are spamming against another blog in the network then $wpdb->avhfdasipcache will point to the avhfdas_ipcache table for that blog (so wp_3_avhfdas_ipcache etc.). That table does not exist and so it throws an error. So either you need to create the avhfdas_ipcache for each and every blog in your network or you need to change the calls in avh-fdas.db.php so that it doesn't use $wpdb->avhfdasipcache but instead derives the tablename using $wpdb->base_prefix (so $wpdb->base_prefix.'avhfdas_ipcache')

  • Kimberly
    • Champion of Loops

    Hi!

    Just checking in :slight_smile:

    I'm guessing that because we haven't heard back from you that you've got your issue worked out or that we have reached the end of our convo here. If you are still having problems or need any other answers on this particular topic please feel free to come back to this thread at anytime. Just be sure to mark it Not Resolved so we don't miss it!

    This ticket is only being Resolved due to lack of activity. It is by no means an action to avoid, brush off or minimize your issue. We are ready and here if you want to re-open at any time and I apologize in advance for any lack of communication if this ticket is being closed in error.

    Thanks for being part of the WPMU DEV Community!

    Best,
    Kimberly

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.