]> git.mjollnir.org Git - moodle.git/commitdiff
Moving attachments attached to forum posts when moving threads between forums was...
authormjollnir_ <mjollnir_>
Tue, 11 Apr 2006 05:19:56 +0000 (05:19 +0000)
committermjollnir_ <mjollnir_>
Tue, 11 Apr 2006 05:19:56 +0000 (05:19 +0000)
mod/forum/lib.php

index e46fa095dabb81214f19e4c6b7d1459f92e6de25..8b262601314d4c2df3243d247f45eaca22ee03aa 100644 (file)
@@ -2342,7 +2342,11 @@ function forum_move_attachments($discussion, $forumid) {
             if (is_dir($oldpostdir)) {
                 $newpost = $oldpost;
                 $newpost->forum = $forumid;
-                $newpostdir = forum_file_area($newpost);
+                $newpostdir = forum_file_area_name($newpost);
+                // take off the last directory because otherwise we're renaming to a directory that already exists
+                // and this is unhappy in certain situations, eg over an nfs mount and potentially on windows too.
+                make_upload_directory(substr($newpostdir,0,strrpos($newpostdir,'/')));
+                $newpostdir = $CFG->dataroot.'/'.forum_file_area_name($newpost);
                 $files = get_directory_list($oldpostdir); // get it before we rename it.
                 if (! @rename($oldpostdir, $newpostdir)) {
                     $return = false;