public function run($request) { echo "Facebook posts are being synced...\n"; FacebookAPI::inst()->syncPosts(); echo FacebookPost::get()->count() . " posts have been synced.\n\n"; echo "Facebook timeline pics are being synced...\n"; FacebookAPI::inst()->syncPics(); echo FacebookTimelinePic::get()->count() . " pics have been synced.\n\n"; echo "Facebook sync done!\n"; }
/** * Gets timeline pics. Suitable for usage in templates. * @param int $limit * @param bool|false $fromAPI * @param bool|false $forceSync * @return ArrayList|DataList|SS_Limitable */ public function getPics($limit = 100, $fromAPI = false, $forceSync = false) { if ($fromAPI) { $pics = $this->requestTimelinePics($limit); } if ($forceSync) { $this->syncPics($limit); } if (!FacebookTimelinePic::get() && !$fromAPI) { $this->syncPics($limit); } if (!$fromAPI) { $pics = FacebookTimelinePic::get()->limit($limit); } return $pics; }