]> git.mjollnir.org Git - moodle.git/commitdiff
assignment: count_user_files() no longer creates extraneous dirs (bug#4658)
authormartinlanghoff <martinlanghoff>
Mon, 31 Jul 2006 04:56:58 +0000 (04:56 +0000)
committermartinlanghoff <martinlanghoff>
Mon, 31 Jul 2006 04:56:58 +0000 (04:56 +0000)
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>

mod/assignment/lib.php

index 7fefab7494c141251c3d560c0ff0c58bbb4fa6cf..a510e7fbe0871cb14586507237009a1ee840c625 100644 (file)
@@ -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);
             }