function cleanUpFollows() { $fd = new FollowDAO($this->db, $this->logger); $continue_fetching = true; while ($this->api->available && $this->api->available_api_calls_for_crawler > 0 && $continue_fetching) { $oldfollow = $fd->getOldestFollow(); $friendship_call = $this->api->cURL_source['show_friendship']; $args = array(); $args["source_id"] = $oldfollow["followee_id"]; $args["target_id"] = $oldfollow["follower_id"]; list($cURL_status, $twitter_data) = $this->api->apiRequest($friendship_call, $this->logger, $args); if ($cURL_status == 200) { try { $friendship = $this->api->parseXML($twitter_data); if ($friendship['source_follows_target'] == 'true') { $fd->update($oldfollow["followee_id"], $oldfollow["follower_id"]); } else { $fd->deactivate($oldfollow["followee_id"], $oldfollow["follower_id"]); } if ($friendship['target_follows_source'] == 'true') { $fd->update($oldfollow["follower_id"], $oldfollow["followee_id"]); } else { $fd->deactivate($oldfollow["follower_id"], $oldfollow["followee_id"]); } } catch (Exception $e) { $status_message = 'Could not parse friendship XML'; } } else { $continue_fetching = false; } } }
function testDeactivate() { $dao = new FollowDAO($this->db, $this->logger); $this->assertTrue(!$dao->deactivate(12, 13)); $this->assertTrue($dao->deactivate(13, 12)); }