summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-05-06 01:26:06 +0000
committerZach Copley <zach@controlyourself.ca>2009-05-06 01:26:06 +0000
commitb291cb8a1be0eb272e1663fbf6c6dea17bdb71db (patch)
tree3358de6553eb3f68198b8657476ea7452693cf0f /scripts
parent99e8f3235f2718f46cc95966ae39e725ee31a7df (diff)
Fix for previous bad patch I pushed (had conflict markers)
Sorry about that.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/statusfetcher.php80
1 files changed, 0 insertions, 80 deletions
diff --git a/scripts/statusfetcher.php b/scripts/statusfetcher.php
index 82ae5bfd4..5518e3aa8 100644
--- a/scripts/statusfetcher.php
+++ b/scripts/statusfetcher.php
@@ -29,11 +29,7 @@ define('LACONICA', true);
// Tune number of processes and how often to poll Twitter
define('MAXCHILDREN', 5);
-<<<<<<< HEAD:scripts/statusfetcher.php
define('POLL_INTERVAL', 60 * 10); // in seconds
-=======
-define('POLL_INTERVAL', 60 * 5); // in seconds
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
// Uncomment this to get useful console output
define('SCRIPT_DEBUG', true);
@@ -44,7 +40,6 @@ $children = array();
do {
-<<<<<<< HEAD:scripts/statusfetcher.php
$flinks = refreshFlinks();
foreach ($flinks as $f){
@@ -52,9 +47,6 @@ do {
// We have to disconnect from the DB before forking so
// each process will open its own connection and
// avoid stomping on each other
-=======
- $flink_ids = refreshFlinks();
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
$conn = &$f->getDatabaseConnection();
$conn->disconnect();
@@ -79,12 +71,7 @@ do {
// Child
-<<<<<<< HEAD:scripts/statusfetcher.php
getTimeline($f, $child_db_name);
-=======
- // XXX: Each child needs its own DB connection
- getTimeline($f);
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
exit();
}
@@ -99,7 +86,6 @@ do {
}
// Wait if we have too many kids
-<<<<<<< HEAD:scripts/statusfetcher.php
if (sizeof($children) > MAXCHILDREN) {
if (defined('SCRIPT_DEBUG')) {
@@ -108,13 +94,6 @@ do {
if (($c = pcntl_wait($status, WUNTRACED)) > 0){
-=======
- if(sizeof($children) > MAXCHILDREN) {
- if (defined('SCRIPT_DEBUG')) {
- print "Too many children. Waiting...\n";
- }
- if(($c = pcntl_wait($status, WUNTRACED)) > 0){
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
if (defined('SCRIPT_DEBUG')) {
print "Finished waiting for $c\n";
}
@@ -149,11 +128,6 @@ do {
function refreshFlinks() {
-<<<<<<< HEAD:scripts/statusfetcher.php
-=======
- global $config;
-
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
$flink = new Foreign_link();
$flink->service = 1; // Twitter
$flink->orderBy('last_noticesync');
@@ -192,7 +166,6 @@ function remove_ps(&$plist, $ps){
function getTimeline($flink)
{
-<<<<<<< HEAD:scripts/statusfetcher.php
if (empty($flink)) {
common_log(LOG_WARNING, "Can't retrieve Foreign_link for foreign ID $fid");
if (defined('SCRIPT_DEBUG')) {
@@ -202,29 +175,6 @@ function getTimeline($flink)
}
$fuser = $flink->getForeignUser();
-=======
- global $config;
- $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
- require_once(INSTALLDIR . '/lib/common.php');
-
- if (defined('SCRIPT_DEBUG')) {
- print "Trying to get timeline for $flink->foreign_id\n";
- }
-
- if (empty($flink)) {
- common_log(LOG_WARNING, "Can't retrieve Foreign_link for foreign ID $fid");
- if (defined('SCRIPT_DEBUG')) {
- print "Can't retrieve Foreign_link for foreign ID $fid\n";
- }
- return;
- }
-
- $fuser = new Foreign_user();
- $fuser->service = 1;
- $fuser->id = $flink->foreign_id;
- $fuser->limit(1);
- $fuser->find(true);
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
if (empty($fuser)) {
common_log(LOG_WARNING, "Unmatched user for ID " . $flink->user_id);
@@ -234,17 +184,11 @@ function getTimeline($flink)
return;
}
-<<<<<<< HEAD:scripts/statusfetcher.php
common_debug('Trying to get timeline for Twitter user ' .
"$fuser->nickname ($flink->foreign_id).");
if (defined('SCRIPT_DEBUG')) {
print 'Trying to get timeline for Twitter user ' .
"$fuser->nickname ($flink->foreign_id).\n";
-=======
- if (defined('SCRIPT_DEBUG')) {
- // XXX: This is horrible and must be removed before releasing this
- print 'username: ' . $fuser->nickname . ' password: ' . $flink->credentials . "\n";
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
}
$url = 'http://twitter.com/statuses/friends_timeline.json';
@@ -282,16 +226,6 @@ function getTimeline($flink)
function saveStatus($status, $flink)
{
-<<<<<<< HEAD:scripts/statusfetcher.php
-=======
-
- global $config;
- $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
- require_once(INSTALLDIR . '/lib/common.php');
-
- // Do we have a profile for this Twitter user?
-
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
$id = ensureProfile($status->user);
$profile = Profile::staticGet($id);
@@ -349,10 +283,6 @@ function saveStatus($status, $flink)
$notice->query('COMMIT');
-<<<<<<< HEAD:scripts/statusfetcher.php
- common_debug("Saved status $status->id as notice $notice->id.");
-=======
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
if (defined('SCRIPT_DEBUG')) {
print "Saved status $status->id as notice $notice->id.\n";
}
@@ -372,11 +302,6 @@ function saveStatus($status, $flink)
function ensureProfile($user)
{
-<<<<<<< HEAD:scripts/statusfetcher.php
-=======
- global $config;
-
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
// check to see if there's already a profile for this user
$profileurl = 'http://twitter.com/' . $user->screen_name;
$profile = Profile::staticGet('profileurl', $profileurl);
@@ -536,11 +461,6 @@ function saveAvatars($user, $id)
function updateAvatar($profile_id, $size, $mediatype, $filename) {
-<<<<<<< HEAD:scripts/statusfetcher.php
-=======
- global $config;
-
->>>>>>> b8c700a7454db825b3867eadfa22afa1e5eb4f6c:scripts/statusfetcher.php
common_debug("Updating avatar: $size");
if (defined('SCRIPT_DEBUG')) {
print "Updating avatar: $size\n";