Support » Plugin: Mendeley Plugin » Empty cache does not work

  • Resolved dinel2016

    (@dinel2016)


    Hello,

    I’ve just realised that empty cache does not work. I don’t know whether this is something new or it hasn’t been working for a while. I noticed that the references were not displayed on my website and it turned out to be because the token has expired. After I renewed the token, I tried to empty cache and it was still not working (but working if I selected a different folder). I had a look at the cache table and it still had content.

    It seems to me that the root of the problem is the use of dbDelta on line 1564. My understanding is that dbDelta is used for different purposes. I manually deleted the contents of the cachetable and the references were displayed again.

    Shouldn’t $wpdb->query be used instead? (i.e. $wpdb->query($sql))
    https://codex.wordpress.org/Class_Reference/wpdb#Running_General_Queries

    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • poundsixzeros

    (@poundsixzeros)

    (I’m not the plugin author but…)
    I think it’s been broken for a while. Every time I either update the plugin or change anything in the configuration I’ve found that I have to manually delete the cache from the db and also delete the access token and then refresh it.

    Thread Starter dinel2016

    (@dinel2016)

    I updated one of my sites and decided to change the code of the plugin. The version I proposed works like a charm. If you do not want to wait till the next version of the plugin is out you can change the code at line 1559 (I included plenty of context so it is possible to see where the change is). The two commented lines are not necessary.

    
    			if (isset($_POST['emptycache_mendeleyPlugin'])) {
    			        global $wpdb;
    			        $table_name = $wpdb->prefix . "mendeleycache";
    				$sql = "delete from ".$table_name." where id>0";
    				//require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    				//dbDelta($sql);
    				$wpdb->query($sql);
    ?>
    <div class="updated"><p><strong><?php _e("Caches emptied.", "MendeleyPlugin"); ?></strong></p></div>
    <?php
    			}
    
    • This reply was modified 4 years ago by dinel2016.
    Plugin Author kochm

    (@kochm)

    Thanks a lot for this constructive feedback! I included the patch in the latest version of the plugin. Another change included in the latest backup is the long seeded bugfix for the automatic refreshing of Mendeley access tokens …

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Empty cache does not work’ is closed to new replies.