Merge branch 'MDL-58399-master' of git://github.com/jleyva/moodle
[moodle.git] / lib / filestorage / stored_file.php
index 481fa35..8eadfbe 100644 (file)
@@ -102,6 +102,15 @@ class stored_file {
         return !empty($this->repository);
     }
 
+    /**
+     * Whether or not this is a controlled link. Note that repositories cannot support FILE_REFERENCE and FILE_CONTROLLED_LINK.
+     *
+     * @return bool
+     */
+    public function is_controlled_link() {
+        return $this->is_external_file() && $this->repository->supported_returntypes() & FILE_CONTROLLED_LINK;
+    }
+
     /**
      * Update some file record fields
      * NOTE: Must remain protected