]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14589: Enforce itemid to always be 0 for user_private.
authorscyrma <scyrma>
Thu, 4 Sep 2008 05:42:17 +0000 (05:42 +0000)
committerscyrma <scyrma>
Thu, 4 Sep 2008 05:42:17 +0000 (05:42 +0000)
lib/file/file_storage.php

index aa706668095953aa691a922b6e5b9c33228d5dbb..bc243c357bf47104e327907762c27ee09b4a285c 100644 (file)
@@ -585,6 +585,7 @@ class file_storage {
      * @param int $itemid  - existing itemid in user draft_area with one or more files
      * @param int $newcontextid  - the new contextid to move files to
      * @param string $newfilearea  - the new filearea to move files to
+     * @param int $newitemid - the new itemid to use (this is ignored and automatically set to 0 when moving to a user's user_private area)
      * @param string $newfilepath  - the new path to move all files to
      * @param bool $overwrite  - overwrite files from the destination if they exist
      * @param int $newuserid  - new userid if required
@@ -604,6 +605,11 @@ class file_storage {
             return false;
         }
 
+        $newcontext = get_context_instance_by_id($newcontextid);
+        if (($newcontext->contextlevel == CONTEXT_USER) && ($newfilearea == 'user_private')) {
+            $newitemid = 0;
+        }
+
     /// Process each file in turn 
 
         $returnfiles = array();