Plugin Directory

Changeset 1248032


Ignore:
Timestamp:
09/18/2015 12:24:25 AM (11 years ago)
Author:
hitoy
Message:

bug fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • super-static-cache/trunk/super-static-cache.php

    r1247197 r1248032  
    44Plugin URI: https://www.hitoy.org/super-static-cache-for-wordperss.html
    55Description: Super Static Cache is an efficient WordPress caching engine which provides three cache mode. It can reduce the pressure of the database significantly that makes your website faster than ever.
    6 Version: 3.2.5
     6Version: 3.2.6
    77Author: Hito
    88Author URI: https://www.hitoy.org/
     
    8181
    8282
    83     $fh = opendir($uri); 
    84     while(($row = readdir($fh)) !== false){ 
    85         if($row == '.' || $row == '..' || $row == 'rewrite_ok.txt'){ 
    86             continue; 
    87         } 
    88         if(!is_dir($uri.'/'.$row)){ 
    89             unlink($uri.'/'.$row); 
    90         } 
    91         delete_uri($uri.'/'.$row); 
    92     } 
    93     closedir($fh); 
    94     //删除文件之后再删除自身 
    95     @rmdir($uri); 
     83    $fh = opendir($uri);
     84    while(($row = readdir($fh)) !== false){
     85        if($row == '.' || $row == '..' || $row == 'rewrite_ok.txt'){
     86            continue;
     87        }
     88        if(!is_dir($uri.'/'.$row)){
     89            unlink($uri.'/'.$row);
     90        }
     91        delete_uri($uri.'/'.$row);
     92    }
     93    closedir($fh);
     94    //删除文件之后再删除自身
     95    @rmdir($uri);
    9696}
    9797
     
    101101    if(function_exists("curl_init")){
    102102        $ch = curl_init();
    103         curl_setopt($ch, CURLOPT_URL, $url); 
     103        curl_setopt($ch, CURLOPT_URL, $url);
    104104        curl_setopt($ch, CURLOPT_REFERER,$url);
    105105        curl_setopt($ch, CURLOPT_TIMEOUT,10);
    106106        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    107107        curl_setopt($ch, CURLOPT_USERAGENT,'SSCS/3 (Super Static Cache Spider/3; +https://www.hitoy.org/super-static-cache-for-wordperss.html#Spider)');
    108         curl_exec($ch); 
    109         curl_close($ch); 
     108        curl_exec($ch);
     109        curl_close($ch);
    110110    }else{
    111111        file_get_contents($url);
     
    147147    //是否是严格模式缓存,默认开启
    148148    //开启严格模式将不缓存既没有后缀,又没有以"/"结尾的uri
    149     private $isstrict;         
     149    private $isstrict;
    150150
    151151    //siteurl
     
    269269            //含有后置的请求
    270270            $cachename = $this->wppath.$cachedir.$realname;
    271         }else if($this->cachemod != 'direct'){ 
     271        }else if($this->cachemod != 'direct'){
    272272            //不管是否严格模式,只要缓存模式不为direct时,都给于缓存
    273273            $cachename = $this->wppath.$cachedir.$realname."/index.html";
     
    381381
    382382$wpssc = new WPStaticCache();
    383 add_action("wp_loaded",array($wpssc,"init"),1);
     383add_action("template_redirect",array($wpssc,"init"),0);
    384384
    385385//更新缓存的动作
     
    394394                $wpssc->build_post_cache($comment);
    395395            }
    396         } 
     396        }
    397397    //发布评论的钩子
    398398    add_action('comment_post','comment_post_hook');
Note: See TracChangeset for help on using the changeset viewer.