MDL-30621 prevent warnings when creating temp and cache dirs

This commit is contained in:
Petr Skoda 2011-12-10 17:35:22 +01:00
parent f89a83b87b
commit adf0fc0e42

View File

@ -1193,7 +1193,10 @@ function make_upload_directory($directory, $exceptiononerror = true) {
*/
function make_temp_directory($directory, $exceptiononerror = true) {
global $CFG;
protect_directory($CFG->tempdir);
if ($CFG->tempdir !== "$CFG->dataroot/temp") {
check_dir_exists($CFG->tempdir, true, true);
protect_directory($CFG->tempdir);
}
return make_writable_directory("$CFG->tempdir/$directory", $exceptiononerror);
}
@ -1206,7 +1209,10 @@ function make_temp_directory($directory, $exceptiononerror = true) {
*/
function make_cache_directory($directory, $exceptiononerror = true) {
global $CFG;
protect_directory($CFG->cachedir);
if ($CFG->cachedir !== "$CFG->dataroot/cache") {
check_dir_exists($CFG->cachedir, true, true);
protect_directory($CFG->cachedir);
}
return make_writable_directory("$CFG->cachedir/$directory", $exceptiononerror);
}