summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-05-15 21:44:58 +0000
committerZach Copley <zach@controlyourself.ca>2009-05-27 00:01:39 +0000
commit2b81dcb25329c496c7c4f2c99334b79ba0421c1e (patch)
treeeaad4b7a847daf36776c8f893432f936a6b2a842
parentb2c28faf526e55ddc97d42692048e644b004e1f8 (diff)
Better err handling when trying to get Facebook client
-rw-r--r--lib/facebookutil.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/facebookutil.php b/lib/facebookutil.php
index ec3987273..242d2e06f 100644
--- a/lib/facebookutil.php
+++ b/lib/facebookutil.php
@@ -27,9 +27,21 @@ define("FACEBOOK_PROMPTED_UPDATE_PREF", 2);
function getFacebook()
{
+ static $facebook = null;
+
$apikey = common_config('facebook', 'apikey');
$secret = common_config('facebook', 'secret');
- return new Facebook($apikey, $secret);
+
+ if ($facebook === null) {
+ $facebook = new Facebook($apikey, $secret);
+ }
+
+ if (!$facebook) {
+ common_log(LOG_ERR, 'Could not make new Facebook client obj!',
+ __FILE__);
+ }
+
+ return $facebook;
}
function updateProfileBox($facebook, $flink, $notice) {
@@ -92,7 +104,6 @@ function isFacebookBound($notice, $flink) {
}
-
function facebookBroadcastNotice($notice)
{
$facebook = getFacebook();