forked from GNUsocial/gnu-social
Better debugging output flag
This commit is contained in:
parent
f21077ce55
commit
44006a35dd
@ -46,7 +46,7 @@ function get_twitter_data($uri, $screen_name, $password)
|
|||||||
common_debug("Twitter bridge - cURL error: $errmsg - trying to load: $uri with user $screen_name.",
|
common_debug("Twitter bridge - cURL error: $errmsg - trying to load: $uri with user $screen_name.",
|
||||||
__FILE__);
|
__FILE__);
|
||||||
|
|
||||||
if (SCRIPT_DEBUG) {
|
if (defined('SCRIPT_DEBUG')) {
|
||||||
print "cURL error: $errmsg - trying to load: $uri with user $screen_name.\n";
|
print "cURL error: $errmsg - trying to load: $uri with user $screen_name.\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ function update_twitter_user($twitter_id, $screen_name)
|
|||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
common_debug("Removed uri ($uri) from another foreign_user who was squatting on it.");
|
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");
|
print("Removed uri ($uri) from another Twitter user who was squatting on it.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ function update_twitter_user($twitter_id, $screen_name)
|
|||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
"Couldn't update foreign_user data for Twitter user: $screen_name");
|
"Couldn't update foreign_user data for Twitter user: $screen_name");
|
||||||
common_log_db_error($fuser, 'UPDATE', __FILE__);
|
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 "UPDATE failed: for Twitter user: $twitter_id - $screen_name. - ";
|
||||||
print common_log_objstring($fuser) . "\n";
|
print common_log_objstring($fuser) . "\n";
|
||||||
$error = &PEAR::getStaticProperty('DB_DataObject','lastError');
|
$error = &PEAR::getStaticProperty('DB_DataObject','lastError');
|
||||||
@ -155,7 +155,7 @@ function add_twitter_user($twitter_id, $screen_name)
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
"Twitter bridge - removed invalid Twitter user squatting on uri: $new_uri");
|
"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";
|
print "Removed invalid Twitter user squatting on uri: $new_uri\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ function add_twitter_user($twitter_id, $screen_name)
|
|||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
"Twitter bridge - failed to add new Twitter user: $twitter_id - $screen_name.");
|
"Twitter bridge - failed to add new Twitter user: $twitter_id - $screen_name.");
|
||||||
common_log_db_error($fuser, 'INSERT', __FILE__);
|
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 "INSERT failed: could not add new Twitter user: $twitter_id - $screen_name. - ";
|
||||||
print common_log_objstring($fuser) . "\n";
|
print common_log_objstring($fuser) . "\n";
|
||||||
$error = &PEAR::getStaticProperty('DB_DataObject','lastError');
|
$error = &PEAR::getStaticProperty('DB_DataObject','lastError');
|
||||||
@ -185,7 +185,7 @@ function add_twitter_user($twitter_id, $screen_name)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
common_debug("Twitter bridge - Added new Twitter user: $screen_name ($twitter_id).");
|
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";
|
print "Added new Twitter user: $screen_name ($twitter_id).\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ function save_twitter_user($twitter_id, $screen_name)
|
|||||||
common_debug('Twitter bridge - Updated nickname (and URI) for Twitter user ' .
|
common_debug('Twitter bridge - Updated nickname (and URI) for Twitter user ' .
|
||||||
"$fuser->id to $screen_name, was $fuser->nickname");
|
"$fuser->id to $screen_name, was $fuser->nickname");
|
||||||
|
|
||||||
if (SCRIPT_DEBUG) {
|
if (defined('SCRIPT_DEBUG')) {
|
||||||
print 'Updated nickname (and URI) for Twitter user ' .
|
print 'Updated nickname (and URI) for Twitter user ' .
|
||||||
"$fuser->id to $screen_name, was $fuser->nickname\n";
|
"$fuser->id to $screen_name, was $fuser->nickname\n";
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password)
|
|||||||
return $friends;
|
return $friends;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SCRIPT_DEBUG) {
|
if (defined('SCRIPT_DEBUG')) {
|
||||||
print "Twitter 'social graph' ids method says $screen_name has " .
|
print "Twitter 'social graph' ids method says $screen_name has " .
|
||||||
count($friends_ids) . " friends.\n";
|
count($friends_ids) . " friends.\n";
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password)
|
|||||||
if ($pages == 0) {
|
if ($pages == 0) {
|
||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
"Twitter bridge - $screen_name seems to have no friends.");
|
"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";
|
print "$screen_name seems to have no friends.\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password)
|
|||||||
if (!$data) {
|
if (!$data) {
|
||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
"Twitter bridge - Couldn't retrieve page $i of $screen_name's friends.");
|
"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";
|
print "Couldn't retrieve page $i of $screen_name's friends.\n";
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -276,7 +276,7 @@ function retreive_twitter_friends($twitter_id, $screen_name, $password)
|
|||||||
|
|
||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
"Twitter bridge - No data for page $i of $screen_name's friends.");
|
"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";
|
print "No data for page $i of $screen_name's friends.\n";
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -295,7 +295,7 @@ function save_twitter_friends($user, $twitter_id, $screen_name, $password)
|
|||||||
|
|
||||||
if (empty($friends)) {
|
if (empty($friends)) {
|
||||||
common_debug("Twitter bridge - Couldn't get friends data from Twitter for $screen_name.");
|
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";
|
print "Couldn't get friends data from Twitter for $screen_name.\n";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -310,7 +310,7 @@ function save_twitter_friends($user, $twitter_id, $screen_name, $password)
|
|||||||
if (!save_twitter_user($friend_id, $friend_name)) {
|
if (!save_twitter_user($friend_id, $friend_name)) {
|
||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
"Twitter bridge - couldn't save $screen_name's friend, $friend_name.");
|
"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";
|
print "Couldn't save $screen_name's friend, $friend_name.\n";
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -328,11 +328,11 @@ function save_twitter_friends($user, $twitter_id, $screen_name, $password)
|
|||||||
|
|
||||||
if ($result === true) {
|
if ($result === true) {
|
||||||
common_debug("Twitter bridge - subscribed $friend_user->nickname to $user->nickname.");
|
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");
|
print("Subscribed $friend_user->nickname to $user->nickname.\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (SCRIPT_DEBUG) {
|
if (defined('SCRIPT_DEBUG')) {
|
||||||
print "$result ($friend_user->nickname to $user->nickname)\n";
|
print "$result ($friend_user->nickname to $user->nickname)\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
|
|||||||
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
|
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
|
||||||
define('LACONICA', true);
|
define('LACONICA', true);
|
||||||
|
|
||||||
// Set this to true to get useful console output
|
// Uncomment this to get useful console output
|
||||||
define('SCRIPT_DEBUG', false);
|
//define('SCRIPT_DEBUG', true);
|
||||||
|
|
||||||
require_once(INSTALLDIR . '/lib/common.php');
|
require_once(INSTALLDIR . '/lib/common.php');
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ while ($flink->fetch()) {
|
|||||||
|
|
||||||
$result = save_twitter_friends($user, $fuser->id,
|
$result = save_twitter_friends($user, $fuser->id,
|
||||||
$fuser->nickname, $flink->credentials);
|
$fuser->nickname, $flink->credentials);
|
||||||
if (SCRIPT_DEBUG) {
|
if (defined('SCRIPT_DEBUG')) {
|
||||||
print "\nDONE\n";
|
print "\nDONE\n";
|
||||||
} else {
|
} else {
|
||||||
print "DONE\n";
|
print "DONE\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user