common_debug("Twitter bridge - cURL error: $errmsg - trying to load: $uri with user $screen_name.",
__FILE__);
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "cURL error: $errmsg - trying to load: $uri with user $screen_name.\n";
}
}
if ($result) {
common_debug("Removed uri ($uri) from another foreign_user who was squatting on it.");
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print("Removed uri ($uri) from another Twitter user who was squatting on it.\n");
}
}
common_log(LOG_WARNING,
"Couldn't update foreign_user data for Twitter user: $screen_name");
common_log_db_error($fuser, 'UPDATE', __FILE__);
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "UPDATE failed: for Twitter user: $twitter_id - $screen_name. - ";
print common_log_objstring($fuser) . "\n";
$error = &PEAR::getStaticProperty('DB_DataObject','lastError');
if ($result) {
common_log(LOG_WARNING,
"Twitter bridge - removed invalid Twitter user squatting on uri: $new_uri");
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "Removed invalid Twitter user squatting on uri: $new_uri\n";
}
}
common_log(LOG_WARNING,
"Twitter bridge - failed to add new Twitter user: $twitter_id - $screen_name.");
common_log_db_error($fuser, 'INSERT', __FILE__);
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "INSERT failed: could not add new Twitter user: $twitter_id - $screen_name. - ";
print common_log_objstring($fuser) . "\n";
$error = &PEAR::getStaticProperty('DB_DataObject','lastError');
}
} else {
common_debug("Twitter bridge - Added new Twitter user: $screen_name ($twitter_id).");
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "Added new Twitter user: $screen_name ($twitter_id).\n";
}
}
common_debug('Twitter bridge - Updated nickname (and URI) for Twitter user ' .
"$fuser->id to $screen_name, was $fuser->nickname");
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print 'Updated nickname (and URI) for Twitter user ' .
"$fuser->id to $screen_name, was $fuser->nickname\n";
}
return $friends;
}
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "Twitter 'social graph' ids method says $screen_name has " .
count($friends_ids) . " friends.\n";
}
if ($pages == 0) {
common_log(LOG_WARNING,
"Twitter bridge - $screen_name seems to have no friends.");
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "$screen_name seems to have no friends.\n";
}
}
if (!$data) {
common_log(LOG_WARNING,
"Twitter bridge - Couldn't retrieve page $i of $screen_name's friends.");
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "Couldn't retrieve page $i of $screen_name's friends.\n";
}
continue;
common_log(LOG_WARNING,
"Twitter bridge - No data for page $i of $screen_name's friends.");
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "No data for page $i of $screen_name's friends.\n";
}
continue;
if (empty($friends)) {
common_debug("Twitter bridge - Couldn't get friends data from Twitter for $screen_name.");
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "Couldn't get friends data from Twitter for $screen_name.\n";
}
return false;
if (!save_twitter_user($friend_id, $friend_name)) {
common_log(LOG_WARNING,
"Twitter bridge - couldn't save $screen_name's friend, $friend_name.");
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "Couldn't save $screen_name's friend, $friend_name.\n";
}
continue;
if ($result === true) {
common_debug("Twitter bridge - subscribed $friend_user->nickname to $user->nickname.");
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print("Subscribed $friend_user->nickname to $user->nickname.\n");
}
} else {
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "$result ($friend_user->nickname to $user->nickname)\n";
}
}
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
define('LACONICA', true);
-// Set this to true to get useful console output
-define('SCRIPT_DEBUG', false);
+// Uncomment this to get useful console output
+//define('SCRIPT_DEBUG', true);
require_once(INSTALLDIR . '/lib/common.php');
$result = save_twitter_friends($user, $fuser->id,
$fuser->nickname, $flink->credentials);
- if (SCRIPT_DEBUG) {
+ if (defined('SCRIPT_DEBUG')) {
print "\nDONE\n";
} else {
print "DONE\n";