From c9a433cdd6c39a857f548f8751b0dda2d1344dc2 Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 6 May 2009 16:10:45 +0000 Subject: [PATCH] MDL-18670 adding proper permissions for mkdir(); merged from MOODLE_19_STABLE --- admin/langimport.php | 8 ++++---- backup/bb/restore_bb.php | 2 +- mod/lesson/importppt.php | 8 +++----- search/indexer.php | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/admin/langimport.php b/admin/langimport.php index 0c10185a49..a3f1102eba 100755 --- a/admin/langimport.php +++ b/admin/langimport.php @@ -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; diff --git a/backup/bb/restore_bb.php b/backup/bb/restore_bb.php index 0793a86068..b55780c516 100644 --- a/backup/bb/restore_bb.php +++ b/backup/bb/restore_bb.php @@ -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"); } diff --git a/mod/lesson/importppt.php b/mod/lesson/importppt.php index 968a61fda3..a378ba5bc4 100644 --- a/mod/lesson/importppt.php +++ b/mod/lesson/importppt.php @@ -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; } diff --git a/search/indexer.php b/search/indexer.php index 4b8efc0890..ef0115d9a8 100644 --- a/search/indexer.php +++ b/search/indexer.php @@ -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 { -- 2.39.5