Plugin Directory

Changeset 170239


Ignore:
Timestamp:
11/04/2009 04:34:36 AM (16 years ago)
Author:
road2nowhere
Message:

added much import delete cache feature

Location:
kivaorg-widget/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • kivaorg-widget/trunk/kiva.php

    r156100 r170239  
    44Plugin URI: http://urpisdream.com/2009/05/kiva-loans-wordpress-widget/
    55Description: Kiva widget, display my investments
    6 Version: 2.8
    7 Author: Marilyn Burgess2
     6Version: 2.9
     7Author: Marilyn Burgess
    88Author URI: http://urpisdream.com
    99*/
     
    187187            $time = time();
    188188
    189             if($time - $cache_time < (60 * 60)){
     189            if($time - $cache_time < (60)){
     190            #if($time - $cache_time < (60 * 60)){
    190191                // Cache is less than an hour old
    191192                return 1;
    192193            }else{
    193194                // delete the old cache
    194                 //$file = "$kiva_cache_dir/$cache_file_original";
    195                 //unlink($file);
     195                $file = "$kiva_cache_dir/$cache_file_original";
     196                unlink($file);
     197                check_for_old_cache_files();
    196198            }
    197199        }
    198200        return 0;   
     201    }
     202
     203    function check_for_old_cache_files(){
     204        global $kiva_cache_dir;
     205
     206        $i = 0;
     207        $limit = 1000;
     208        if (is_dir($kiva_cache_dir)) {
     209            if ($dh = opendir($kiva_cache_dir)) {
     210                while (($file = readdir($dh)) !== false) {
     211                    if(! is_dir($file)){
     212                        if( preg_match("/^kiva_cache_/", $file)){
     213                            // delelte the file
     214                            unlink("$kiva_cache_dir/$file");
     215                        }
     216                    }
     217                    $i++;
     218                    if($i == $limit){
     219                        break;
     220                    }
     221                }
     222            }
     223        }
    199224    }
    200225
  • kivaorg-widget/trunk/readme.txt

    r156100 r170239  
    44Tags: kiva, widgit
    55Requires at least: 2.8
    6 Tested up to: 2.8.4
    7 Stable tag: 2.8
     6Tested up to: 2.8.5
     7Stable tag: 2.9
    88
    99Displays rotating entrepreneurs the blogger has invested in publically. Links back to Kiva.
     
    2626Lender Page. under .My Portfolio. on Kiva.org.
    2727
     28Version 2.9 includes an important update that fixes a big problem that causes the kiva file cache
     29to fill up and take up lots of space. Please upgrade asap!
     30
     31Version 2.8 includes an important update that handles when the Kiva server is unavailable.
     32
    2833Version 2.7 includes an important upgrade that allows Kiva to track the widgets requests. Please
    2934upgrade your copy of the Kive Wordpress widget.
    3035
    31 Version 2.8 includes an important update that handles when the Kiva server is unavailable.
     36
    3237
    3338== Installation ==
Note: See TracChangeset for help on using the changeset viewer.