Delete the app_access_token once the addon is uninstalled. And some more error handling

This commit is contained in:
Tobias Hößl 2012-03-18 10:59:01 +00:00
parent 3503adb8cc
commit 519edd184b

View file

@ -75,6 +75,7 @@ function facebook_uninstall() {
unregister_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings'); unregister_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
if (get_config('facebook', 'realtime_active') == 1) facebook_subscription_del_users(); if (get_config('facebook', 'realtime_active') == 1) facebook_subscription_del_users();
del_config('facebook', 'app_access_token');
} }
@ -150,8 +151,12 @@ function facebook_init(&$a) {
$s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token); $s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token);
if($s) { if($s) {
$j = json_decode($s); $j = json_decode($s);
logger('facebook_init: wall: ' . print_r($j,true), LOGGER_DATA); if (isset($j->data)) {
fb_consume_stream($uid,$j,($private_wall) ? false : true); logger('facebook_init: wall: ' . print_r($j,true), LOGGER_DATA);
fb_consume_stream($uid,$j,($private_wall) ? false : true);
} else {
logger('facebook_init: wall: got no data from Facebook: ' . print_r($j,true), LOGGER_NORMAL);
}
} }
} }
@ -1018,15 +1023,23 @@ function fb_consume_all($uid) {
$s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token); $s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token);
if($s) { if($s) {
$j = json_decode($s); $j = json_decode($s);
logger('fb_consume_stream: wall: ' . print_r($j,true), LOGGER_DATA); if (isset($j->data)) {
fb_consume_stream($uid,$j,($private_wall) ? false : true); logger('fb_consume_stream: wall: ' . print_r($j,true), LOGGER_DATA);
fb_consume_stream($uid,$j,($private_wall) ? false : true);
} else {
logger('fb_consume_stream: wall: got no data from Facebook: ' . print_r($j,true), LOGGER_NORMAL);
}
} }
} }
$s = fetch_url('https://graph.facebook.com/me/home?access_token=' . $access_token); $s = fetch_url('https://graph.facebook.com/me/home?access_token=' . $access_token);
if($s) { if($s) {
$j = json_decode($s); $j = json_decode($s);
logger('fb_consume_stream: feed: ' . print_r($j,true), LOGGER_DATA); if (isset($j->data)) {
fb_consume_stream($uid,$j,false); logger('fb_consume_stream: feed: ' . print_r($j,true), LOGGER_DATA);
fb_consume_stream($uid,$j,false);
} else {
logger('fb_consume_stream: feed: got no data from Facebook: ' . print_r($j,true), LOGGER_NORMAL);
}
} }
} }