]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Documentation and more understandable code.
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 4 Mar 2015 12:29:18 +0000 (13:29 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 4 Mar 2015 12:29:18 +0000 (13:29 +0100)
lib/imagefile.php

index 26663eed7b14d8fafb6b9ce8750576783da8539c..97aa85c1ffb1e6a21508ec9d90dac80d17f74c84 100644 (file)
@@ -61,11 +61,16 @@ class ImageFile
     {
         $this->id = $id;
         if (!empty($this->id)) {
-            $this->fileRecord = File::getKV('id', $this->id);
-            if (!$this->fileRecord instanceof File) {
-                throw new ServerException('Expected File object did not exist.');
+            $this->fileRecord = new File();
+            $this->fileRecord->id = $this->id;
+            if (!$this->find(true)) {
+                // If we have set an ID, we need that ID to exist!
+                throw new NoResultException($this->fileRecord);
             }
         }
+
+        // These do not have to be the same as fileRecord->filename for example,
+        // since we may have generated an image source file from something else!
         $this->filepath = $filepath;
         $this->filename = basename($filepath);