Save attached URLs when importing a Twitter status: this lets our thumbnail detection handle photos and videos linked to by Twitter posters.

This commit is contained in:
Brion Vibber 2010-11-12 17:40:34 -08:00
parent 2c33fdd2fb
commit 398e622fec

View File

@ -189,6 +189,7 @@ class TwitterImport
Notice_to_status::saveNew($notice->id, $status->id);
$this->saveStatusMentions($notice, $status);
$this->saveStatusAttachments($notice, $status);
$notice->blowOnInsert();
@ -648,4 +649,20 @@ class TwitterImport
}
}
}
/**
* Record URL links from the notice. Needed to get thumbnail records
* for referenced photo and video posts, etc.
*
* @param Notice $notice
* @param object $status
*/
function saveStatusAttachments($notice, $status)
{
if (!empty($status->entities) && !empty($status->entities->urls)) {
foreach ($status->entities->urls as $url) {
File::processNew($url->url, $notice->id);
}
}
}
}