Merge remote-tracking branch 'upstream/nightly' into nightly

This commit is contained in:
www-data 2016-08-13 22:16:35 +02:00
commit 12cd0af111
2 changed files with 9 additions and 0 deletions

View File

@ -693,6 +693,13 @@ class File extends Managed_DataObject
return $title ?: null; return $title ?: null;
} }
public function setTitle($title)
{
$orig = clone($this);
$this->title = mb_strlen($title) > 0 ? $title : null;
return $this->update($orig);
}
static public function hashurl($url) static public function hashurl($url)
{ {
if (empty($url)) { if (empty($url)) {

View File

@ -174,7 +174,9 @@ class OembedPlugin extends Plugin
if ($oembed_data === false) { if ($oembed_data === false) {
throw new Exception('Did not get oEmbed data from URL'); throw new Exception('Did not get oEmbed data from URL');
} }
$file->setTitle($oembed_data->title);
} catch (Exception $e) { } catch (Exception $e) {
common_log(LOG_WARN, sprintf(__METHOD__.': %s thrown when getting oEmbed data: %s', get_class($e), _ve($e->getMessage())));
return true; return true;
} }