check before inserting File_oembed and File_thumbnail

This commit is contained in:
Evan Prodromou 2010-01-10 13:18:53 -08:00
parent 9d3893255a
commit f463329b9a
1 changed files with 7 additions and 0 deletions

View File

@ -80,7 +80,14 @@ class File extends Memcached_DataObject
if (isset($redir_data['type'])
&& (('text/html' === substr($redir_data['type'], 0, 9) || 'application/xhtml+xml' === substr($redir_data['type'], 0, 21)))
&& ($oembed_data = File_oembed::_getOembed($given_url))) {
$fo = File_oembed::staticGet('file_id', $file_id);
if (empty($fo)) {
File_oembed::saveNew($oembed_data, $file_id);
} else {
common_log(LOG_WARNING, "Strangely, a File_oembed object exists for new file $file_id", __FILE__);
}
}
return $x;
}