From: skodak Date: Sat, 16 Aug 2008 21:21:23 +0000 (+0000) Subject: MDL-15977 create_file_from_storedfile should accept an original file object X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8eb1e0a15ca864605572f89f34aac676064750b5;p=moodle.git MDL-15977 create_file_from_storedfile should accept an original file object --- diff --git a/lib/file/file_storage.php b/lib/file/file_storage.php index 353bf39f56..5bb9e9f73f 100644 --- a/lib/file/file_storage.php +++ b/lib/file/file_storage.php @@ -353,10 +353,15 @@ class file_storage { public function create_file_from_storedfile($file_record, $fid) { global $DB; + if ($fid instanceof stored_file) { + $fid = $fid->get_id(); + } + $file_record = (array)$file_record; // we support arrays too unset($file_record['id']); unset($file_record['filesize']); unset($file_record['contenthash']); + unset($file_record['pathnamehash']); $now = time();