From 72d0aed6ab554a536b1f14fad721ce023b7d9fd0 Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 14 Oct 2009 08:53:50 +0000 Subject: [PATCH] MDL-14591 improved docs when copying files - thanks Nicolas forspotting this --- lib/file/file_storage.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/file/file_storage.php b/lib/file/file_storage.php index ecd6869332..be9b29ec36 100644 --- a/lib/file/file_storage.php +++ b/lib/file/file_storage.php @@ -453,14 +453,16 @@ class file_storage { /** * Add new local file based on existing local file * @param mixed $file_record object or array describing changes - * @param int $fid id of existing local file - * @return object stored_file instance + * @param mixed $fileorid id or stored_file instance of the existing local file + * @return object stored_file instance of newly created file */ - public function create_file_from_storedfile($file_record, $fid) { + public function create_file_from_storedfile($file_record, $fileorid) { global $DB; - if ($fid instanceof stored_file) { - $fid = $fid->get_id(); + if ($fileorid instanceof stored_file) { + $fid = $fileorid->get_id(); + } else { + $fid = $fileorid; } $file_record = (array)$file_record; // we support arrays too, do not modify the submitted record! -- 2.39.5