Plugin Directory

Changeset 1269078


Ignore:
Timestamp:
10/20/2015 03:41:47 AM (10 years ago)
Author:
hitoy
Message:

update t0 3.2.9

Location:
super-static-cache/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • super-static-cache/trunk/languages/super_static_cache-zh_CN.po

    r1266323 r1269078  
    33"Project-Id-Version: super static cache 3.0\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2015-10-15 14:01+0800\n"
    6 "PO-Revision-Date: 2015-10-15 14:01+0800\n"
     5"POT-Creation-Date: 2015-10-20 11:34+0800\n"
     6"PO-Revision-Date: 2015-10-20 11:36+0800\n"
    77"Last-Translator: hitoy <vip@hitoy.org>\n"
    88"Language-Team: hitoy <vip@hitoy.org>\n"
     
    164164#: options-general.php:24
    165165msgid ""
    166 "<p>Only for Direct Mode, if your enable this function, url like <em>http://"
    167 "www.example.com/123</em> will be cached, it may be cause some error.</p>"
    168 msgstr ""
    169 "<p>仅针对Direct模式,如果你开启这项功能,像<em>http://www.example.com/123</"
    170 "em>这种的url将会被缓存,但可能会导致一些错误。</p>"
     166"<p>Only for Direct Mode, if your close this function, url like <em>http://"
     167"www.example.com/123</em> will be cached, it may be cause some error.</"
     168"p><p>If you don't know how to configure it, just keep it as it is.</p>"
     169msgstr ""
     170"<p>仅针对Direct模式,如果你关闭这项功能,像http://www.example.com/123这种的"
     171"url将会被缓存,但可能会导致一些错误。</p><p>如果你不知道如何配置,保持原样就"
     172"行。</p>"
    171173
    172174#: options-general.php:25
     
    290292msgstr "捐赠"
    291293
     294#~ msgid ""
     295#~ "<p>Only for Direct Mode, if your enable this function, url like "
     296#~ "<em>http://www.example.com/123</em> will be cached, it may be cause some "
     297#~ "error.</p>"
     298#~ msgstr ""
     299#~ "<p>仅针对Direct模式,如果你开启这项功能,像<em>http://www.example."
     300#~ "com/123</em>这种的url将会被缓存,但可能会导致一些错误。</p>"
     301
    292302#~ msgid "Save »"
    293303#~ msgstr "保存 »"
  • super-static-cache/trunk/options-general.php

    r1266323 r1269078  
    2222            <h3 class="hndle"><?php _e('Enable Strict Cache Mode','super_static_cache');?></h3>
    2323            <div class="inside">
    24                 <?php _e('<p>Only for Direct Mode, if your enable this function, url like <em>http://www.example.com/123</em> will be cached, it may be cause some error.</p>','super_static_cache')?>
     24                <?php _e('<p>Only for Direct Mode, if your close this function, url like <em>http://www.example.com/123</em> will be cached, it may be cause some error.</p><p>If you don\'t know how to configure it, just keep it as it is.</p>','super_static_cache')?>
    2525                <input type="radio" name="super_static_cache_strict" value="true" <?php theselected('super_static_cache_strict',true);?>><label><?php _e('on','super_static_cache');?></label>
    2626                <input type="radio" name="super_static_cache_strict" value="false" <?php theselected('super_static_cache_strict',false);?>><label><?php _e('off','super_static_cache');?></label>
  • super-static-cache/trunk/readme.txt

    r1266323 r1269078  
    55Requires at least: 3.0.1
    66Tested up to: 4.3
    7 Stable tag: 3.2.8
     7Stable tag: 3.2.9
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2727
    2828== Upgrade Notice ==
     29= 3.2.9 =
     30* cache file File permissions func update
     31* bug fixed
     32
    2933= 3.2.8 =
    3034* Bug Fixed
  • super-static-cache/trunk/super-static-cache.php

    r1266363 r1269078  
    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.8
     6Version: 3.2.9
    77Author: Hito
    88Author URI: https://www.hitoy.org/
     
    111111}
    112112//给目录赋予权限
    113 function chmods($path,$mod=0777,$rec=true){
    114         if($rec==false){
    115                 return chmod($path,$mod);
     113function chmods($path,$dirmod=0777,$filemod=0666,$rec=true){
     114        if($rec==false || is_file($path)){
     115                return @chmod($path,$filemod);
    116116        }
    117117        if(is_dir($path)){
    118                 chmod($path,$mod);
     118                @chmod($path,$dirmod);
    119119                $dir=opendir($path);
    120120                while(($file = readdir($dir)) !== false){
    121121                        if($file == '.' || $file == '..') continue;
    122122                        $ffile=$path.'/'.$file;
    123                         if(is_file($ffile))  chmod($ffile,$mod);
     123                        if(is_file($ffile))  @chmod($ffile,$filemod);
    124124                        if(is_dir($ffile)) {
    125                                 chmod($ffile,$mod);
    126                                 if($rec==true) chmods($ffile,$mod,$rec);
     125                                @chmod($ffile,$dirmod);
     126                                if($rec==true) chmods($ffile,$dirmod,$filemod,$rec);
    127127                        }
    128128                }
     
    294294
    295295                //对含有查询的情况进行过滤
    296                 preg_match("/^([^?]+)?/i",$this->wpuri,$match);
    297                 $realname=urldecode($match[1]);
     296                preg_match("/^\/([^?]+)?/i",$this->wpuri,$match);
     297                $realname=!empty($match[1])?urldecode($match[1]):"";
     298
    298299                //去掉目录之后的文件名
    299300                $fname=substr($realname,strripos($realname,"/")+1);
    300 
     301                   
    301302                if($this->cachemod == 'serverrewrite' || $this->cachemod == 'phprewrite'){
    302                         $cachedir='super-static-cache';
    303                 }else {
     303                        $cachedir='super-static-cache/';
     304                }else if($this->cachemod == 'direct'){
    304305                        $cachedir='';
    305306                }
    306 
    307307                if($fname == ""){
    308308                        //以'/'结尾的请求
     
    323323        }
    324324
    325         //写入并保存缓存,最终动作
     325        //写入缓存,并赋予相应的文件权限便于其它工具进行处理
    326326        //满足三种情况
    327327        //1, url能缓存 filename存在
    328         //2, 文件名不存在(保护原有的文件不被改写)
    329         //3, 缓存的内容不为空
     328        //2, 缓存的内容不为空
     329        //3, 文件名不存在(保护原有的文件不被改写)
    330330        public function save_cache_content(){
    331331                $filename = $this->get_cache_fname();
    332                 if($filename && !file_exists($filename) && strlen($this->htmlcontent) > 0){
     332                if($filename && strlen($this->htmlcontent) > 0 && !file_exists($filename)){
    333333                        //创建存放缓存的目录
    334334                        mkdirs(dirname($filename));
     
    336336                        file_put_contents($filename,$this->htmlcontent,LOCK_EX);
    337337
    338                         //给于缓存的操作权限
    339                         if($this->cachemod == 'serverrewrite' || $this->cachemod == 'phprewrite'){
    340                                 $cachedir='super-static-cache';
    341                         }else {
    342                                 $cachedir='';
     338                        //对缓存文件的权限进行更改
     339                        $relauri=substr($filename,strlen($this->wppath)-1);
     340                        preg_match("/^\/([^?]+)?/i",$relauri,$match);
     341                        $realname=!empty($match[1])?urldecode($match[1]):"";
     342                        $relapath=substr($realname,0,strpos($realname,'/'));
     343                        if($relapath==""){
     344                            chmods($filename,0777,0666,false);
     345                        }else if($relapath != "" && $this->cachemod == "direct"){
     346                            chmods($this->wppath.$relapath,0777,0666,true);
     347                        }else if($relapath != "" && $this->cachemod == "serverrewrite" || $this->cachemod == "phprewrite"){
     348                            chmods($this->wppath."super-static-cache/".$relapath,0777,0666,true);
    343349                        }
    344                         $modir=substr($filename,0,strlen($this->wppath.$cachedir));
    345                         //chmods($modir,0777);
    346350                }
    347351        }
     
    406410        public function install(){
    407411                add_option("super_static_cache_mode","close");
    408                 add_option("super_static_cache_strict",false);
     412                add_option("super_static_cache_strict",true);
    409413                add_option("super_static_cache_excet","author,date,attachment");
    410414                add_option("update_cache_action","publish_post,post_updated,trashed_post,publish_page");
     
    415419                }
    416420                file_put_contents($this->wppath."super-static-cache/rewrite_ok.txt","This is a test file from rewrite rules,please do not to remove it.\n");
    417                 chmods($this->wppath.'super-static-cache',0777);
     421                chmods($this->wppath.'super-static-cache',0777,0444,true);
    418422        }
    419423        //卸载函数
     
    423427                delete_option("super_static_cache_strict");
    424428                delete_option("update_cache_action");
    425                 //删除
     429                //删除一些必要的缓存
    426430                delete_uri($this->wppath."super-static-cache/rewrite_ok.txt");
    427431                delete_uri($this->wppath.'super-static-cache');
    428                 if($this->cachemod=='direct'){
    429                         delete_uri($this->wppath.'index.html');
     432                if($this->cachemod=="direct" && is_file($this->wppath."index.html")){
     433                        delete_uri($this->wppath."index.html");
    430434                }
    431435        }
Note: See TracChangeset for help on using the changeset viewer.