Skip to content

Commit

Permalink
MDL-18670 adding proper permissions for mkdir(); merged from MOODLE_1…
Browse files Browse the repository at this point in the history
…9_STABLE
  • Loading branch information
skodak committed May 6, 2009
1 parent a9a0b93 commit c9a433c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions admin/langimport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion backup/bb/restore_bb.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
8 changes: 3 additions & 5 deletions mod/lesson/importppt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion search/indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

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 {
Expand Down

0 comments on commit c9a433c

Please sign in to comment.