Changeset 1269078
- Timestamp:
- 10/20/2015 03:41:47 AM (10 years ago)
- Location:
- super-static-cache/trunk
- Files:
-
- 5 edited
-
languages/super_static_cache-zh_CN.mo (modified) (previous)
-
languages/super_static_cache-zh_CN.po (modified) (3 diffs)
-
options-general.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
super-static-cache.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
super-static-cache/trunk/languages/super_static_cache-zh_CN.po
r1266323 r1269078 3 3 "Project-Id-Version: super static cache 3.0\n" 4 4 "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" 7 7 "Last-Translator: hitoy <vip@hitoy.org>\n" 8 8 "Language-Team: hitoy <vip@hitoy.org>\n" … … 164 164 #: options-general.php:24 165 165 msgid "" 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>" 169 msgstr "" 170 "<p>仅针对Direct模式,如果你关闭这项功能,像http://www.example.com/123这种的" 171 "url将会被缓存,但可能会导致一些错误。</p><p>如果你不知道如何配置,保持原样就" 172 "行。</p>" 171 173 172 174 #: options-general.php:25 … … 290 292 msgstr "捐赠" 291 293 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 292 302 #~ msgid "Save »" 293 303 #~ msgstr "保存 »" -
super-static-cache/trunk/options-general.php
r1266323 r1269078 22 22 <h3 class="hndle"><?php _e('Enable Strict Cache Mode','super_static_cache');?></h3> 23 23 <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')?> 25 25 <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> 26 26 <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 5 5 Requires at least: 3.0.1 6 6 Tested up to: 4.3 7 Stable tag: 3.2. 87 Stable tag: 3.2.9 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 27 27 28 28 == Upgrade Notice == 29 = 3.2.9 = 30 * cache file File permissions func update 31 * bug fixed 32 29 33 = 3.2.8 = 30 34 * Bug Fixed -
super-static-cache/trunk/super-static-cache.php
r1266363 r1269078 4 4 Plugin URI: https://www.hitoy.org/super-static-cache-for-wordperss.html 5 5 Description: 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. 86 Version: 3.2.9 7 7 Author: Hito 8 8 Author URI: https://www.hitoy.org/ … … 111 111 } 112 112 //给目录赋予权限 113 function chmods($path,$ mod=0777,$rec=true){114 if($rec==false ){115 return chmod($path,$mod);113 function chmods($path,$dirmod=0777,$filemod=0666,$rec=true){ 114 if($rec==false || is_file($path)){ 115 return @chmod($path,$filemod); 116 116 } 117 117 if(is_dir($path)){ 118 chmod($path,$mod);118 @chmod($path,$dirmod); 119 119 $dir=opendir($path); 120 120 while(($file = readdir($dir)) !== false){ 121 121 if($file == '.' || $file == '..') continue; 122 122 $ffile=$path.'/'.$file; 123 if(is_file($ffile)) chmod($ffile,$mod);123 if(is_file($ffile)) @chmod($ffile,$filemod); 124 124 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); 127 127 } 128 128 } … … 294 294 295 295 //对含有查询的情况进行过滤 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 298 299 //去掉目录之后的文件名 299 300 $fname=substr($realname,strripos($realname,"/")+1); 300 301 301 302 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'){ 304 305 $cachedir=''; 305 306 } 306 307 307 if($fname == ""){ 308 308 //以'/'结尾的请求 … … 323 323 } 324 324 325 //写入 并保存缓存,最终动作325 //写入缓存,并赋予相应的文件权限便于其它工具进行处理 326 326 //满足三种情况 327 327 //1, url能缓存 filename存在 328 //2, 文件名不存在(保护原有的文件不被改写)329 //3, 缓存的内容不为空328 //2, 缓存的内容不为空 329 //3, 文件名不存在(保护原有的文件不被改写) 330 330 public function save_cache_content(){ 331 331 $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)){ 333 333 //创建存放缓存的目录 334 334 mkdirs(dirname($filename)); … … 336 336 file_put_contents($filename,$this->htmlcontent,LOCK_EX); 337 337 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); 343 349 } 344 $modir=substr($filename,0,strlen($this->wppath.$cachedir));345 //chmods($modir,0777);346 350 } 347 351 } … … 406 410 public function install(){ 407 411 add_option("super_static_cache_mode","close"); 408 add_option("super_static_cache_strict", false);412 add_option("super_static_cache_strict",true); 409 413 add_option("super_static_cache_excet","author,date,attachment"); 410 414 add_option("update_cache_action","publish_post,post_updated,trashed_post,publish_page"); … … 415 419 } 416 420 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); 418 422 } 419 423 //卸载函数 … … 423 427 delete_option("super_static_cache_strict"); 424 428 delete_option("update_cache_action"); 425 //删除 429 //删除一些必要的缓存 426 430 delete_uri($this->wppath."super-static-cache/rewrite_ok.txt"); 427 431 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"); 430 434 } 431 435 }
Note: See TracChangeset
for help on using the changeset viewer.