Changeset 808578
- Timestamp:
- 11/22/2013 02:40:43 AM (12 years ago)
- Location:
- tr-cache-and-security/trunk/inc
- Files:
-
- 2 edited
-
actions.php (modified) (1 diff)
-
cache_security_clean.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tr-cache-and-security/trunk/inc/actions.php
r808562 r808578 62 62 $path = TRSCSC_CACHE_PATH; 63 63 } 64 $handle = @opendir($path); 65 if ($handle) 66 { 67 while ($file = readdir($handle)) 68 { 69 if ($file != '.' && $file != '..') 70 { 71 @unlink($path . '/' . $file); 72 } 73 } 74 closedir($handle); 75 } 64 tr_cache_clear_by_dir($path,0,time() + 999999); 65 66 //clear cache js 67 $path = WP_CONTENT_DIR .'/'. TRSCSC_CACHE_JS; 68 tr_cache_clear_by_dir($path,0,time() + 999999); 69 70 $path = WP_CONTENT_DIR .'/'. TRSCSC_CACHE_CSS; 71 tr_cache_clear_by_dir($path,0,time() + 999999); 72 73 76 74 echo 'ok'; 77 75 exit(); 76 } 77 78 function tr_cache_clear_by_dir($path,$timeout,$current_time) 79 { 80 $handle = @opendir($path); 81 if ($handle) { 82 while ($file = readdir($handle)) { 83 if ($file == '.' || $file == '..' || $file[0] == '_') continue; 84 85 $t = @filemtime($path . '/' . $file); 86 if ($current_time - $t > $timeout ) { 87 @unlink($path . '/' . $file); 88 } 89 } 90 } 91 @closedir($handle); 78 92 } 79 93 -
tr-cache-and-security/trunk/inc/cache_security_clean.php
r808562 r808578 1 1 <?php 2 2 global $wpdb; 3 include_once (TRSCSC_PATH . 'inc/actions.php'); 3 4 4 function tr_cache_clear_dir($path,$timeout,$current_time)5 {6 $handle = @opendir($path);7 if ($handle) {8 while ($file = readdir($handle)) {9 if ($file == '.' || $file == '..' || $file[0] == '_') continue;10 11 $t = @filemtime($path . '/' . $file);12 if ($current_time - $t > $timeout ) {13 @unlink($path . '/' . $file);14 }15 }16 }17 @closedir($handle);18 }19 5 20 6 //clear cache … … 25 11 if ($timeout >0 && $cache_options['on']) 26 12 { 27 tr_cache_clear_ dir(TRSCSC_CACHE_PATH,$timeout,$current_time);13 tr_cache_clear_by_dir(TRSCSC_CACHE_PATH,$timeout,$current_time); 28 14 } 29 15 … … 31 17 $path = WP_CONTENT_DIR .'/'. TRSCSC_CACHE_JS; 32 18 $timeout = ($timeout < $timeout30)? $timeout30 : $timeout; 33 tr_cache_clear_ dir($path,$timeout,$current_time);19 tr_cache_clear_by_dir($path,$timeout,$current_time); 34 20 35 21 //clear cache css 36 22 $path = WP_CONTENT_DIR .'/'. TRSCSC_CACHE_CSS; 37 23 $timeout = ($timeout < $timeout30)? $timeout30 : $timeout; 38 tr_cache_clear_ dir($path,$timeout,$current_time);24 tr_cache_clear_by_dir($path,$timeout,$current_time); 39 25 40 26 //end clear cache … … 100 86 101 87 if($need_update_htacess) 102 { 103 include_once (TRSCSC_PATH . 'inc/actions.php'); 88 { 104 89 trwr_action_change_htaccess(); 105 90 }
Note: See TracChangeset
for help on using the changeset viewer.