Plugin Directory

Changeset 615847


Ignore:
Timestamp:
10/22/2012 11:41:02 PM (13 years ago)
Author:
pantsonhead
Message:

v0.5 Fixed caching issues

Location:
activitysparks/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • activitysparks/trunk/activitysparks.php

    r608727 r615847  
    55Plugin URI: http://www.pantsonhead.com/wordpress/activitysparks/
    66Description: A widget to display a customizable sparkline graph of post and/or comment activity.
    7 Version: 0.4.2
     7Version: 0.5
    88Author: Greg Jackson
    99Author URI: http://www.pantsonhead.com
     
    5151
    5252        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
    53         $cachetime = intval($instance['cachetime'][$category_id]);
     53        $cachetime = intval($instance['cachetime']);
    5454
    5555        if($cachetime){
    56             $url = $instance['url'][$category_id];
    57             if($url=='' OR (time()-intval($instance['url_time'][$category_id]))>$cachetime) {
    58                 $settings = get_option($this->option_name);
    59                 $url = $settings[$this->number]['url'][$category_id] = $this->build_url($instance);
    60                 $settings[$this->number]['url_time'][$category_id]=time();
    61                 update_option( $this->option_name, $settings );
     56            $cachekey = md5($args['widget_id'].$category_id);
     57            $url = get_transient($cachekey);
     58            if($url===FALSE){
     59                $url = $this->build_url($instance,$category_id);
     60                set_transient($cachekey,$url,$cachetime);
    6261            }
    6362        } else {
     
    7170        echo '<img src="'.$url.'">';
    7271        echo $after_widget;
    73    
    7472    }
    7573   
     
    135133        $now_tick = $wpdb->get_row("SELECT ROUND((TO_DAYS(now()))/$period) tick")->tick;
    136134
    137         $category_posts_join = $category_comments_join = $category_where = '';
    138135        if($category_id) {
    139136            $category_posts_join = " INNER JOIN {$wpdb->prefix}term_relationships ON {$wpdb->prefix}posts.ID = {$wpdb->prefix}term_relationships.object_id
  • activitysparks/trunk/readme.txt

    r608727 r615847  
    5656== Changelog ==
    5757
     58= v0.5 2012-10-23 =
     59
     60* Fixed caching issues.
     61
    5862= v0.4.2 2012-10-05 =
    5963
Note: See TracChangeset for help on using the changeset viewer.