예제 #1
0
                    } else {
                        exit("Done!\n");
                    }
                }
            }
        } else {
            echo "No data from instagram" . "\n";
        }
        $updatedCount = ORM::for_table('photos')->where('updated', $date)->where('tag', $tag)->count();
        $i = $updatedCount;
    }
}
if ($mode == "best100") {
    $photos = ORM::for_table('photos')->order_by_desc('likes')->limit(100)->find_many();
    foreach ($photos as $photo) {
        $result = $instagram->getMedia($photo->photo_id);
        if ($result) {
            if ($photo->likes != $result->data->likes->count || $photo->comments != $result->data->comments->count) {
                $photo->likes = $result->data->likes->count;
                $photo->comments = $result->data->comments->count;
                $photo->updated = $date;
                $photo->save();
                echo "Update photo: " . $photo->id . "\n";
            }
        }
    }
}
if ($mode == "users") {
    if (empty($number)) {
        $users = ORM::for_table('user')->order_by_desc('followers')->find_many();
    } else {