MDL-18670 adding proper permissions for mkdir(); merged from MOODLE_19_STABLE

This commit is contained in:
skodak 2009-05-06 16:10:45 +00:00
parent a9a0b93de1
commit c9a433cdd6
4 changed files with 9 additions and 11 deletions

View File

@ -50,8 +50,8 @@
if (confirm_sesskey() and !empty($pack)) {
set_time_limit(0);
@mkdir ($CFG->dataroot.'/temp/'); //make it in case it's a fresh install, it might not be there
@mkdir ($CFG->dataroot.'/lang/');
@mkdir ($CFG->dataroot.'/temp/', $CFG->directorypermissions); //make it in case it's a fresh install, it might not be there
@mkdir ($CFG->dataroot.'/lang/', $CFG->directorypermissions);
if (is_array($pack)) {
$packs = $pack;
@ -173,8 +173,8 @@
}
}
@mkdir ($CFG->dataroot.'/temp/');
@mkdir ($CFG->dataroot.'/lang/');
@mkdir ($CFG->dataroot.'/temp/', $CFG->directorypermissions);
@mkdir ($CFG->dataroot.'/lang/', $CFG->directorypermissions);
foreach ($packs as $pack){ //for each of the remaining in the list, we
if ($pack == 'en_utf8') { // no update for en_utf8
continue;

View File

@ -74,7 +74,7 @@ function blackboard_convert($dir){
// Copy the Blackboard course files into the moodle course_files structure
$subdirs = get_subdirs($dir."/");
mkdir("$dir/course_files");
mkdir("$dir/course_files", $CFG->directorypermissions);
foreach ($subdirs as $subdir){
rename($subdir, "course_files/$subdir");
}

View File

@ -126,7 +126,7 @@ function readdata($file, $courseid, $modname) {
$path_parts = pathinfo($zipfile);
$dirname = substr($zipfile, 0, strpos($zipfile, '.'.$path_parts['extension'])); // take off the extension
if (!file_exists($base.$dirname)) {
mkdir($base.$dirname);
mkdir($base.$dirname, $CFG->directorypermissions);
}
// move our uploaded file to temp/lesson
@ -204,7 +204,7 @@ function extract_data($pages, $courseid, $lessonname, $modname) {
while(true) {
if (!file_exists($imagedir.'/'.$lessonname.$i)) {
// ok doesnt exist so make the directory and update our paths
mkdir($imagedir.'/'.$lessonname.$i);
mkdir($imagedir.'/'.$lessonname.$i, $CFG->directorypermissions);
$imagedir = $imagedir.'/'.$lessonname.$i;
$imagelink = $imagelink.'/'.$lessonname.$i;
break;
@ -575,9 +575,7 @@ function book_save_objects($chapters, $bookid, $pageid='0') {
// nothing fancy, just save them all in order
foreach ($chapters as $chapter) {
if (!$chapter->id = $DB->insert_record('book_chapters', $chapter)) {
print_error('cannotupdatebook', 'lesson');
}
$chapter->id = $DB->insert_record('book_chapters', $chapter);
}
return true;
}

View File

@ -89,7 +89,7 @@ require_once($CFG->dirroot.'/search/lib.php');
if (!file_exists($index_path)) {
mtrace("Data directory ($index_path) does not exist, attempting to create.");
if (!mkdir($index_path)) {
if (!mkdir($index_path, $CFG->directorypermissions)) {
search_pexit("Error creating data directory at: $index_path. Please correct.");
}
else {