Added safeguard to avoid removing root directory when BOINC_DOWNLOAD_DIR and BOINC_UPLOAD_DIR environment variables aren't declared.

svn path=/trunk/boinc/; revision=77
This commit is contained in:
Eric Heien 2002-05-30 16:54:06 +00:00
parent b9ffe20c2d
commit abc9aa5d7e
1 changed files with 12 additions and 0 deletions

View File

@ -63,6 +63,18 @@ function clear_data_dirs() {
global $BOINC_DOWNLOAD_DIR;
global $BOINC_UPLOAD_DIR;
$BOINC_DOWNLOAD_DIR = getenv("BOINC_DOWNLOAD_DIR");
if ($BOINC_DOWNLOAD_DIR == null) {
echo "Must define BOINC_DOWNLOAD_DIR\n";
$bad = true;
}
$BOINC_UPLOAD_DIR = getenv("BOINC_UPLOAD_DIR");
if ($BOINC_UPLOAD_DIR == null) {
echo "Must define BOINC_UPLOAD_DIR\n";
$bad = true;
}
if ($bad) exit();
PassThru("rm -f $BOINC_DOWNLOAD_DIR/*");
PassThru("rm -f $BOINC_UPLOAD_DIR/*");
}