Skip to content

Commit

Permalink
assignment: count_user_files() no longer creates extraneous dirs (bug…
Browse files Browse the repository at this point in the history
…#4658)

Applied the fix by Samuli.Karevaara, from the bug report - the directory is checked for existence beforehand.
Previously it was created if it didn't exist, then the files within it were counted.


Author: Luke Hudson <luke@catalyst.net.nz>
  • Loading branch information
martinlanghoff committed Jul 31, 2006
1 parent 21c2f2e commit 3ad4a10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mod/assignment/lib.php
Expand Up @@ -1487,7 +1487,7 @@ function count_user_files($userid) {


$filearea = $this->file_area_name($userid); $filearea = $this->file_area_name($userid);


if ($basedir = $this->file_area($userid)) { if ( is_dir($filearea) && $basedir = $this->file_area($userid)) {
if ($files = get_directory_list($basedir)) { if ($files = get_directory_list($basedir)) {
return count($files); return count($files);
} }
Expand Down

0 comments on commit 3ad4a10

Please sign in to comment.