Create a temporary directory called silverstripe-cache in the project folder if access to the tmp folder is restricted

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@39797 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-08-09 22:03:28 +00:00
parent b31d08041b
commit eb700a58b7

View File

@ -15,7 +15,22 @@ function getTempFolder() {
} }
$ssTmp = "$sysTmp/silverstripe-cache"; $ssTmp = "$sysTmp/silverstripe-cache";
if(!file_exists($ssTmp)) mkdir($ssTmp); if(!file_exists($ssTmp)) {
@$worked = mkdir($ssTmp);
}
if(!$worked) {
$ssTmp = dirname(dirname($_SERVER['SCRIPT_FILENAME'])) . "/silverstripe-cache";
$worked = true;
if(!file_exists($ssTmp)) {
@$worked = mkdir($ssTmp);
}
}
if(!$worked) {
user_error("Permission problem gaining access to a temp folder. " .
"Please create a folder named silverstripe-cache in the base folder " .
"of the installation and ensure it has the correct permissions", E_USER_ERROR);
}
return $ssTmp; return $ssTmp;
} }