Changeset 1189 in t29-www
- Timestamp:
- Mar 30, 2017, 11:02:21 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/wipe-cache.php
r353 r1189 16 16 17 17 if(isset($_GET['wipe'])) { 18 $command = "rm -r $cache_dir/* 2>&1";19 18 print "<h3>Cache-Leerung</h3>"; 20 print shell_exec($command);19 rrmdir_sub($cache_dir); 21 20 print "Fertig"; 22 21 print "<h3>Erneut Cache leeren?</h3>"; … … 35 34 36 35 37 <h3> Details</h3>36 <h3>Zum Cache-System</h3> 38 37 39 38 <p>Die technikum29-Website wird seit Version 6 mit PHP und einem mehrstufigen … … 47 46 <?php 48 47 foreach($page_cache->test_files as $file) { 49 print "<tr><td class='left'><tt>$file</tt><td>".date ("F d Y H:i:s", filemtime($file)); 48 print "<tr><td class='left'><tt>$file</tt><td>".(file_exists($file) ? 49 date ("F d Y H:i:s", filemtime($file)) 50 : "<i>does not exist</i>"); 50 51 } 51 52 ?> 52 53 </table> 54 55 <h3>Im Cache befindliche Dateien</h3> 56 <?php 57 $all_cache_files = getDirContents($cache_dir); 58 ?> 59 60 <p>Im <a href="/shared/cache">t29-Cache</a> auf diesem Host (<tt><?php print $host; ?></tt>) 61 befinden sich derzeit folgende 62 <strong><?php print count($all_cache_files); ?> Dateien und Ordner</strong>:</p> 63 64 <table class="t29-details"> 65 <tr><th>Datei<th>Letzte Änderung 66 <?php 67 foreach($all_cache_files as $file) { 68 print "<tr><td class='left'><tt>$file</tt><td>".(file_exists($file) ? 69 date ("F d Y H:i:s", filemtime($file)) 70 : "<i>does not exist</i>"); 71 } 72 ?> 73 </table> 74 <?php> 53 75 54 76 <?php … … 70 92 return $size; 71 93 } 94 95 // Delete from $path, including $path, using an recursive iterator 96 function rrmdir($path) { 97 if(is_file($path)) { 98 unlink($path); 99 return; 100 } 101 102 $i = new DirectoryIterator($path); 103 foreach($i as $f) { 104 if($f->isFile()) { 105 unlink($f->getRealPath()); 106 } else if(!$f->isDot() && $f->isDir()) { 107 rrmdir($f->getRealPath()); 108 } 109 } 110 rmdir($path); 111 } 112 113 // delete everything *below* path, but keep $path 114 function rrmdir_sub($path) { 115 array_map('rrmdir', glob("$path/*")); 116 # print "Would delete:<pre> "; 117 # var_dump(glob("$path/*")); 118 } 119 120 // get a list of all files below $dir, recursively. 121 function getDirContents($dir, &$results = array()){ 122 $files = scandir($dir); 123 124 foreach($files as $key => $value){ 125 $path = realpath($dir.DIRECTORY_SEPARATOR.$value); 126 if(!is_dir($path)) { 127 $results[] = $path; 128 } else if($value != "." && $value != "..") { 129 getDirContents($path, $results); 130 $results[] = $path; 131 } 132 } 133 134 return $results; 135 }
Note: See TracChangeset
for help on using the changeset viewer.