• Resolved Ambyomoron

    (@josiah-s-carberry)


    I am trying to understand and clean up my web server error log. The following error is occurring there:

    PHP message: WordPress database error Unknown column 'active_theme' in 'field list' for query SELECT active_theme FROM wp_harrys_gravatar_cache WHERE ID = 1 made by require_once('wp-admin/admin.php'), do_action('settings_page_harrys-gravatar-cache-options'), WP_Hook->do_action, WP_Hook->apply_filters, Einstellungen, referer: https://www.mysite.com/wp-admin/options-general.php?page=harrys-gravatar-cache-options

    It apparently occurs only in the settings page for the plugin, but I cannot determine what or when.

    Since the table does not contain a column named active_theme, what is the point of this query? Is there something incorrectly installed on my site? Something incorrectly configured? How can this error be avoided?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Harry Milatz

    (@harry-milatz)

    Hi Josiah,

    this query is need to check if the theme has been changed after installing and activating the plugin. And if it is changed, the cache will be emptied.

    When you enter the setting page, the plugin is looking in the wp_options table for the active theme and store it(if it is not stored there) in the table from the plugin. So there should be a colum “active_theme” in the plugin table.
    The Plugin uses $active_theme_wp=get_option('template'); to get this from the options and compare it with the stored value in the plugin table and update it if it is different or insert it if it is missing.

    Can you look in the table “harrys_gravatar_cache” from the plugin with phpmyadmin or something else? Compare it with the png-file database.png from the plugin folder and give me an info.

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    Here are the differences.
    In my version of the table:
    size = 40, not 67
    fopen = 1, not 0
    active_theme is not there

    I’m sure I would have noticed an error message within WP during the initial installation, but cannot recall anything.

    Should I just delete the plugin and reinstall it?

    Plugin Author Harry Milatz

    (@harry-milatz)

    The difference on size and fopen depends on your server and your theme, that is normal.
    But active_theme have to be there.

    Yes, please try this. Deactivate the plugin and delete it in the backend.
    After deinstalling and delteting please check if the table from the plugin is deleted too. The plugin should do this automatically.
    Then reinstall it.

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    Plugin is now reinstalled and the table data looks good.

    I note the following errors in the Apache error log associated with the installation (probably in reverse chronological order). I would be grateful if you were to confirm that they are expected:

    [Sun Nov 19 21:17:03 2017] [error] PHP message: WordPress database error Duplicate column name 'active_theme' for query ALTER TABLEwp_harrys_gravatar_cacheADDactive_themeTEXT NOT NULL AFTERcopy` made by activate_plugin, do_action(‘activate_harrys-gravatar-cache/harrys-gravatar-cache.php’), WP_Hook->do_action, WP_Hook->apply_filters, harrys_gravatar_cache_installation, harrys_gravatar_cache_activation, get_size_gravatar_hgc, referer: https://www.mysite.com/wp-admin/plugin-install.php?s=gravatar&tab=search&type=term
    [Sun Nov 19 21:17:03 2017] [error] PHP message: WordPress database error Table ‘my_acct.wp_harrys_gravatar_cache’ doesn’t exist for query SELECT cache_time FROM wp_harrys_gravatar_cache WHERE ID = 1 made by activate_plugin, include_once(‘/plugins/harrys-gravatar-cache/harrys-gravatar-cache.php’), referer: https://www.mysite.com/wp-admin/plugin-install.php?s=gravatar&tab=search&type=term
    [Sun Nov 19 21:17:03 2017] [error] PHP message: WordPress database error Table ‘my_acct.wp_harrys_gravatar_cache’ doesn’t exist for query SELECT get_option FROM wp_harrys_gravatar_cache WHERE ID = 1 made by activate_plugin, include_once(‘/plugins/harrys-gravatar-cache/harrys-gravatar-cache.php’), referer: https://www.mysite.com/wp-admin/plugin-install.php?s=gravatar&tab=search&type=term
    [Sun Nov 19 21:17:03 2017] [error] PHP message: WordPress database error Table ‘my_acct.wp_harrys_gravatar_cache’ doesn’t exist for query SELECT size_get FROM wp_harrys_gravatar_cache WHERE ID = 1 made by activate_plugin, include_once(‘/plugins/harrys-gravatar-cache/harrys-gravatar-cache.php’), referer: https://www.mysite.com/wp-admin/plugin-install.php?s=gravatar&tab=search&type=term
    [Sun Nov 19 21:17:03 2017] [error] PHP message: WordPress database error Table ‘my_acct.wp_harrys_gravatar_cache’ doesn’t exist for query SELECT size FROM wp_harrys_gravatar_cache WHERE ID = 1 made by activate_plugin, include_once(‘/plugins/harrys-gravatar-cache/harrys-gravatar-cache.php’), referer: https://www.mysite.com/wp-admin/plugin-install.php?s=gravatar&tab=search&type=term
    [Sun Nov 19 21:17:03 2017] [error] PHP message: WordPress database error Table ‘my_acct.wp_harrys_gravatar_cache’ doesn’t exist for query SELECT is_writeable FROM wp_harrys_gravatar_cache WHERE ID = 1 made by activate_plugin, include_once(‘/plugins/harrys-gravatar-cache/harrys-gravatar-cache.php’), referer: https://www.mysite.com/wp-admin/plugin-install.php?s=gravatar&tab=search&type=term`

    Plugin Author Harry Milatz

    (@harry-milatz)

    The first one is expected, because the plugin checks if it is a new installation(the error is there) or if it is an update(the error should not be there).

    The other errors are not really expected…
    Is the table named “my_acct.wp_harrys_gravatar_cache” in your installation?
    It seems the plugin could not get the prefix for the tables in your installation.
    Where did you define the “my_acct.”?
    Are you on a singlesite or multisite installation of WP?

    Are there “new” errors when you enter the options page from the plugin?

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    I have obfuscated the messages that I displayed above. “my_acct” corresponds to the name of the database as defined in wp-config.php. Furthermore, I have modified the prefix for the table names, so the table name is not “my_acct.wp_harrys_gravatar_cache”. It is “<something else>.<something>_harrys_gravatar_cache”

    I see no additional errors in the log following a change in the settings. Furthermore, the plugin appears to be working, with correct images added to the cache directory.

    Plugin Author Harry Milatz

    (@harry-milatz)

    Ok, then everything should be fine. I will change the function(s) for installing the database and adding keys/values in it and updating it in one of the next updates to avoid errors like this ones;)

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    Vielen dank!

    Plugin Author Harry Milatz

    (@harry-milatz)

    Gerne:)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘no active_theme in table’ is closed to new replies.