From: martinlanghoff Date: Mon, 31 Jul 2006 04:56:58 +0000 (+0000) Subject: assignment: count_user_files() no longer creates extraneous dirs (bug#4658) X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0ff463ae95199265dc5a2fd692f47af17ae3a0b7;p=moodle.git assignment: count_user_files() no longer creates extraneous dirs (bug#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 --- diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 7fefab7494..a510e7fbe0 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -1487,7 +1487,7 @@ class assignment_base { $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)) { return count($files); }