summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Cohen2011-09-06 18:23:52 (GMT)
committer Dave Cohen2011-09-06 18:23:52 (GMT)
commitdb804874b1e9656a95074201a6972f5eabd9c2d4 (patch)
tree9fff7b403b6be9945ee0995541d0143a3850d091
parentce9f64003a3ca9236a43f17953da45f7a9f664d4 (diff)
refs #1166272 by Dave Cohen: Sanity check version of facebook api.
-rw-r--r--fb.install12
-rw-r--r--fb.module10
2 files changed, 19 insertions, 3 deletions
diff --git a/fb.install b/fb.install
index 071c48b..900c0b8 100644
--- a/fb.install
+++ b/fb.install
@@ -62,9 +62,15 @@ function fb_requirements($phase) {
$fb_platform = variable_get(FB_VAR_API_FILE, $fb_lib_path . '/src/facebook.php');
if (class_exists('Facebook')) {
- $status['description'] = $t('Facebook PHP SDK loaded.');
- $status['severity'] = REQUIREMENT_OK;
- $status['value'] = $t('Loaded');
+ $status['value'] = Facebook::VERSION;
+ if (Facebook::VERSION >= "3") {
+ $status['description'] = $t('Expected version 2.x.y of Facebook PHP SDK.');
+ $status['severity'] = REQUIREMENT_ERROR;
+ }
+ else {
+ $status['description'] = $t('Facebook PHP SDK loaded.');
+ $status['severity'] = REQUIREMENT_OK;
+ }
}
elseif (include($fb_platform)) { // include() better than file_exists().
$status['description'] = $t('Facebook SDK found at %path',
diff --git a/fb.module b/fb.module
index 42126d4..86932aa 100644
--- a/fb.module
+++ b/fb.module
@@ -387,6 +387,16 @@ function fb_api_init($fb_app) {
return NULL;
}
+ if (Facebook::VERSION >= "3") {
+ $message = 'This version of modules/fb is compatible with Facebook PHP SDK version 2.x, but %version was found. Either upgrade modules/fb or downgrade %fb_platform.';
+ $args = array('%fb_platform' => $fb_platform, '%version' => Facebook::VERSION);
+ if (user_access('access administration pages')) {
+ drupal_set_message(t($message, $args));
+ }
+ watchdog('fb', $message, $args, WATCHDOG_ERROR);
+ return NULL;
+ }
+
// We don't have a cached resource for this app, so we're going to create one.
$fb = new Facebook(array(
'appId' => $fb_app->id,