]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
check before saving a thumbnail
authorEvan Prodromou <evan@status.net>
Sun, 10 Jan 2010 21:25:16 +0000 (13:25 -0800)
committerEvan Prodromou <evan@status.net>
Sun, 10 Jan 2010 21:25:16 +0000 (13:25 -0800)
classes/File_oembed.php

index e41ccfd097eb4d415d02d587f2fc08d6d7e57ecc..11f160718ef21b38ebf6043384b3fc8ffff2dfae 100644 (file)
@@ -115,7 +115,13 @@ class File_oembed extends Memcached_DataObject
         }
         $file_oembed->insert();
         if (!empty($data->thumbnail_url)) {
-            File_thumbnail::saveNew($data, $file_id);
+            $ft = File_thumbnail::staticGet('file_id', $file_id);
+            if (!empty($ft)) {
+                common_log(LOG_WARNING, "Strangely, a File_thumbnail object exists for new file $file_id",
+                           __FILE__);
+            } else {
+                File_thumbnail::saveNew($data, $file_id);
+            }
         }
     }
 }