From 8eb1e0a15ca864605572f89f34aac676064750b5 Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 16 Aug 2008 21:21:23 +0000 Subject: [PATCH] MDL-15977 create_file_from_storedfile should accept an original file object --- lib/file/file_storage.php | 5 +++++ 1 file changed, 5 insertions(+) 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(); -- 2.39.5