File::processNew can return -1 which was not true for empty()

Also, File->getEnclosure() now throws exception if not enough metadata.
This commit is contained in:
Mikael Nordfeldth
2014-06-02 01:26:23 +02:00
parent d596513e39
commit d6f52f5939
5 changed files with 26 additions and 21 deletions

View File

@@ -364,16 +364,13 @@ class File extends Managed_DataObject
Event::handle('FileEnclosureMetadata', array($this, &$enclosure));
}
}
if (empty($enclosure->mimetype)) {
// This means we don't know what it is, so it can't be an enclosure!
throw new ServerException('Unknown enclosure mimetype, not enough metadata');
}
return $enclosure;
}
// quick back-compat hack, since there's still code using this
function isEnclosure()
{
$enclosure = $this->getEnclosure();
return !empty($enclosure);
}
/**
* Get the attachment's thumbnail record, if any.
* Make sure you supply proper 'int' typed variables (or null).