]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/File_oembed.php
wiring in magicsig
[quix0rs-gnu-social.git] / classes / File_oembed.php
index 94de8e117eb00a04e52405dc4c221202f7232822..11f160718ef21b38ebf6043384b3fc8ffff2dfae 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, Control Yourself, Inc.
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -17,7 +17,7 @@
  * along with this program.     If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
 
 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
 require_once INSTALLDIR.'/classes/File_redirection.php';
@@ -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);
+            }
         }
     }
 }