mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-17 05:48:49 +00:00
removed a redundant foreachloop
also moved some data validation into the function that uses the data. This change is geared towards making this code more unit testable.
This commit is contained in:
parent
9a26a253c9
commit
68383f2552
1 changed files with 6 additions and 9 deletions
|
@ -213,6 +213,10 @@ function fbsync_expire($a,$b) {
|
|||
|
||||
function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $create_user) {
|
||||
|
||||
$post->actor_id = number_format($post->actor_id, 0, '', '');
|
||||
$post->source_id = number_format($post->source_id, 0, '', '');
|
||||
$post->app_id = number_format($post->app_id, 0, '', '');
|
||||
|
||||
$access_token = get_pconfig($uid,'facebook','access_token');
|
||||
|
||||
require_once("include/oembed.php");
|
||||
|
@ -1078,23 +1082,16 @@ function fbsync_fetchfeed($a, $uid) {
|
|||
}
|
||||
unset($applications);
|
||||
|
||||
foreach ($posts AS $post) {
|
||||
$post->actor_id = number_format($post->actor_id, 0, '', '');
|
||||
$post->source_id = number_format($post->source_id, 0, '', '');
|
||||
$post->app_id = number_format($post->app_id, 0, '', '');
|
||||
$post_data[$post->post_id] = $post;
|
||||
}
|
||||
unset($posts);
|
||||
|
||||
foreach($comments AS $comment) {
|
||||
$comment->fromid = number_format($comment->fromid, 0, '', '');
|
||||
$comment_data[$comment->id] = $comment;
|
||||
}
|
||||
unset($comments);
|
||||
|
||||
foreach ($post_data AS $post) {
|
||||
foreach ($posts AS $post) {
|
||||
if ($post->updated_time > $last_updated)
|
||||
$last_updated = $post->updated_time;
|
||||
|
||||
fbsync_createpost($a, $uid, $self, $contacts, $application_data, $post, $create_user);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue