]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14591 improved docs when copying files - thanks Nicolas forspotting this
authorskodak <skodak>
Wed, 14 Oct 2009 08:53:50 +0000 (08:53 +0000)
committerskodak <skodak>
Wed, 14 Oct 2009 08:53:50 +0000 (08:53 +0000)
lib/file/file_storage.php

index ecd68693328c0bfee6fea593ce417eef7092e0cc..be9b29ec36ff5c9fa6e01c9cdc4e34aa097e6a6b 100644 (file)
@@ -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!