MDL-22546 improving dir creation handling and improving dataroot support in config only scripts; using 02777 as default in lib/setup.php to match the default in config-dist.php

This commit is contained in:
Petr Skoda 2010-05-22 19:59:59 +00:00
parent 173ba4f1ca
commit 4cee2155b2
2 changed files with 12 additions and 11 deletions

View file

@ -9239,8 +9239,9 @@ function remove_dir($dir, $content_only=false) {
function check_dir_exists($dir, $create=false, $recursive=false) {
global $CFG;
if (strstr(cleardoubleslashes($dir), cleardoubleslashes($CFG->dataroot.'/')) === false) {
if (strpos(str_replace('\\', '/', $dir), str_replace('\\', '/', $CFG->dataroot.'/')) !== 0) {
debugging('Warning. Wrong call to check_dir_exists(). $dir must be an absolute path under $CFG->dataroot ("' . $dir . '" is incorrect)', DEBUG_DEVELOPER);
return false;
}
$status = true;