function fb_devel_requirements in Drupal for Facebook 6.2
Same name and namespace in other branches
- 6.3 fb_devel.install \fb_devel_requirements()
- 7.3 fb_devel.install \fb_devel_requirements()
Implementation of hook_requirements().
Show warnings as necessary in Status Report page.
File
- ./
fb_devel.install, line 15 - Install file for fb_devel.module.
Code
function fb_devel_requirements($phase) {
$t = get_t();
$items = array();
if ($phase == 'runtime') {
$result = db_query('SELECT count(uid) FROM {users} WHERE data LIKE "%\\"app_specific\\"%" OR data LIKE "%\\"is_app_user\\"%" OR data LIKE "\\"fbu\\"%"');
$count = db_result($result);
if ($count) {
$status = array(
'title' => $t('Drupal for Facebook obsolete data.'),
'description' => $t('Early versions of Drupal for Facebook stored information in users table. Leave fb_devel.module enabled, and this data will be cleared during cron jobs.'),
);
$status['value'] = $t('Found %count rows', array(
'%count' => $count,
));
$status['severity'] = REQUIREMENT_WARNING;
$items[] = $status;
}
// Confirm no accounts without authmap. The problem caused by old bug, should only occur on sites that have been upgraded.
$result = db_query('SELECT count(u.uid) FROm {users} u LEFT JOIN {authmap} a ON u.uid=a.uid WHERE u.name LIKE "%@facebook%" AND a.uid IS NULL');
$count = db_result($result);
if ($count) {
$status = array(
'title' => $t('Accounts Named NNN@facebook Without authmap'),
'description' => $t('Drupal for Facebook may have failed to create authmap entry for these accounts. Please report to the Drupal for Facebook issue queue, we are working on a fix.'),
'value' => $count,
'severity' => REQUIREMENT_WARNING,
);
$items[] = $status;
}
}
// Test if json extensions are loaded.
if (defined('SERVICES_JSON_SLICE')) {
// defined in facebook's json wrapper, which is not compatible with PHP's JSON extensions.
$items[] = array(
'title' => $t('JSON extension for PHP'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('JSON extension must be present for Drupal for Facebook modules. You can wait (forever) for facebook to <a href="!url">fix their bug</a>, or install the JSON extension. ', array(
'!url' => 'http://bugs.developers.facebook.com/show_bug.cgi?id=4351',
)),
);
}
// arg_separator sanity check
$sep = ini_get('arg_separator.output');
if ($sep != '&') {
$items[] = array(
'title' => $t('Argument Separator'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('Facebook client libraries will not work properly if arg_separator.output is not "&". Currently the value is "!sep". Please change this in settings.php or php.ini.', array(
'!sep' => check_plain($sep),
)),
);
}
// clean url sanity check
if (!variable_get('clean_url', FALSE) && module_exists('fb_canvas') && $phase == 'runtime') {
$message = $items[] = array(
'title' => $t('Clean URLs'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('Drupal for Facebook will not function properly until <a href=!url>clean URLs</a> are turned on.', array(
'!url' => url('admin/settings/clean-urls'),
)),
);
}
// Moved files sanity check.
if (file_exists(drupal_get_path('module', 'fb_devel') . '/fb_feed.module')) {
$items[] = array(
'title' => $t('Drupal for Facebook obsolete files'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('Drupal for Facebook modules have moved to <em>modules/fb/contrib/</em>, but your install still has old out-of-date files! Delete the entire <em>modules/fb/</em> directory and re-install.'),
);
}
if (!count($items) && $phase == 'runtime') {
$items[] = array(
'title' => $t('Drupal for Facebook Devel'),
'value' => $t('No worries'),
'description' => $t('All sanity checks OK.'),
);
}
return $items;
}