diff --git a/fb.install b/fb.install index 071c48b280de72dc7285dc767251fb725eb8b1c4..900c0b87fa765dc5dfeb3e67c990f016e3bcbe1d 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 42126d46e48c1a0a913874d67f91a0ee66f69444..86932aa18bd25f086764e289fc41462c608b5c0f 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,