*** empty log message ***

svn path=/trunk/boinc/; revision=4139
This commit is contained in:
David Anderson 2004-09-01 22:51:23 +00:00
parent 781f99201d
commit 57d1d4a697
3 changed files with 30 additions and 10 deletions

View File

@ -16861,3 +16861,13 @@ Rom 1 Sep 2004
client/translations/ client/translations/
<Many Files> <Many Files>
David 1 Sep 2004
- fixed bug in web-caching code that caused files in html/user
to be randomly deleted.
The function clean_cache($dir) was enumerating files in $dir,
and doing unlink($file), but without chdir'ing into $dir
or concatenating $dir onto $file.
html/inc
cache.inc

View File

@ -20,7 +20,7 @@ computer resources
</center> </center>
<br clear=all> <br clear=all>
<table width=100% border=0 cellspacing=0 cellpadding=20> <table width=100% border=0 cellspacing=0 cellpadding=10>
<tr> <tr>
<td valign=top width=40%> <td valign=top width=40%>
<a href=intro.php>Overview of BOINC</a> <a href=intro.php>Overview of BOINC</a>
@ -72,6 +72,9 @@ BOINC-based distributed computing projects include:
<a href=http://climateprediction.net>Climateprediction.net</a>: <a href=http://climateprediction.net>Climateprediction.net</a>:
Improve the accuracy of long-range climate prediction. Improve the accuracy of long-range climate prediction.
<li> <li>
<a href=http://athome.web.cern.ch/athome/>LHC@home</a>:
Help to build the CERN LHC accelerator.
<li>
<a href=http://predictor.scripps.edu>Predictor@home</a>: <a href=http://predictor.scripps.edu>Predictor@home</a>:
Solve biomedical questions of protein-related diseases. Solve biomedical questions of protein-related diseases.
<li><a href=http://setiweb.ssl.berkeley.edu/>SETI@home</a>: <li><a href=http://setiweb.ssl.berkeley.edu/>SETI@home</a>:
@ -80,7 +83,7 @@ looking for evidence of extraterrestrial life.
</ul> </ul>
We encourage you to participate in multiple projects, We encourage you to participate in multiple projects,
so that your computer will be kept busy even so that your computer will be kept busy even
while a project is down or out of work. while projects are down or out of work.
<center> <center>

View File

@ -45,14 +45,21 @@ function disk_usage($dir) {
return $usage; return $usage;
} }
function clean_cache($max_age,$dir="../cache") { function clean_cache($max_age, $dir) {
if ($handle=@opendir($dir)) { chdir($dir);
if ($handle=@opendir(".")) {
while ($file=readdir($handle)) { while ($file=readdir($handle)) {
if (($file != ".") && ($file != "..")) { if ($file == ".") continue;
if (@is_dir($dir."/".$file)) { if ($file == "..") continue;
clean_cache($max_age,$dir."/".$file);
} else { // don't let hackers trick us into deleting other files!
if ((time()-@filemtime($file))>$max_age) @unlink($file); if (substr($file, "..")) continue;
if (@is_dir($dir."/".$file)) {
clean_cache($max_age, $dir."/".$file);
} else {
if ((time()-@filemtime($file))>$max_age) {
//echo "unlinking $dir/$file\n";
@unlink($file);
} }
} }
} }
@ -67,7 +74,7 @@ function start_cache($max_age, $params=""){
$too_old=86400; $too_old=86400;
while ((disk_free_space("../cache") < MIN_FREE_SPACE) || while ((disk_free_space("../cache") < MIN_FREE_SPACE) ||
(disk_usage("../cache") > MAX_CACHE_USAGE)) { (disk_usage("../cache") > MAX_CACHE_USAGE)) {
clean_cache($too_old); clean_cache($too_old, "../cache");
$too_old/=2; $too_old/=2;
} }
} }