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

@@ -384,13 +384,15 @@ class ApiAction extends Action
$twitter_status['attachments'] = array();
foreach ($attachments as $attachment) {
$enclosure_o=$attachment->getEnclosure();
if ($enclosure_o) {
try {
$enclosure_o = $attachment->getEnclosure();
$enclosure = array();
$enclosure['url'] = $enclosure_o->url;
$enclosure['mimetype'] = $enclosure_o->mimetype;
$enclosure['size'] = $enclosure_o->size;
$twitter_status['attachments'][] = $enclosure;
} catch (ServerException $e) {
// There was not enough metadata available
}
}
}
@@ -510,13 +512,15 @@ class ApiAction extends Action
$enclosures = array();
foreach ($attachments as $attachment) {
$enclosure_o=$attachment->getEnclosure();
if ($enclosure_o) {
try {
$enclosure_o = $attachment->getEnclosure();
$enclosure = array();
$enclosure['url'] = $enclosure_o->url;
$enclosure['mimetype'] = $enclosure_o->mimetype;
$enclosure['size'] = $enclosure_o->size;
$enclosures[] = $enclosure;
} catch (ServerException $e) {
// There was not enough metadata available
}
}