ENHANCEMENT Always use sys_get_temp_dir() which will return the system

temp folder for PHP 5.2+, since we don't support older versions we don't
need to patch around this any longer.
This commit is contained in:
Sean Harvey 2012-04-16 12:17:30 +12:00
parent d0984ec897
commit 3ff6002936

View File

@ -285,19 +285,6 @@ Debug::loadErrorHandlers();
///////////////////////////////////////////////////////////////////////////////
// HELPER FUNCTIONS
function getSysTempDir() {
if(function_exists('sys_get_temp_dir')) {
$sysTmp = sys_get_temp_dir();
} elseif(isset($_ENV['TMP'])) {
$sysTmp = $_ENV['TMP'];
} else {
$tmpFile = tempnam('adfadsfdas','');
unlink($tmpFile);
$sysTmp = dirname($tmpFile);
}
return $sysTmp;
}
/**
* Returns the temporary folder that silverstripe should use for its cache files
* This is loaded into the TEMP_FOLDER define on start up
@ -319,7 +306,7 @@ function getTempFolder($base = null) {
return $ssTmp;
}
$sysTmp = getSysTempDir();
$sysTmp = sys_get_temp_dir();
$worked = true;
$ssTmp = "$sysTmp/$cachefolder";
@ -335,12 +322,6 @@ function getTempFolder($base = null) {
}
}
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;
}
@ -416,7 +397,7 @@ function increase_memory_limit_to($memoryLimit = -1) {
// Increase the memory limit if it's too low
if($memoryLimit == -1 || translate_memstring($memoryLimit) > translate_memstring($curLimit)) {
ini_set('memory_limit', $memoryLimit);
}
}
return true;
}