| Commit | Line | Data |
|---|---|---|
| 30241683 | 1 | <?php |
| 456be90c DC |
2 | /** |
| 3 | * @file | |
| 4 | * Install file for fb_devel.module. | |
| 19092d2f | 5 | * |
| 456be90c | 6 | */ |
| 30241683 | 7 | |
| 30241683 DC |
8 | /** |
| 9 | * Implementation of hook_requirements(). | |
| 10 | * | |
| 11 | * Show warnings as necessary in Status Report page. | |
| 12 | * | |
| 13 | */ | |
| 14 | function fb_devel_requirements($phase) { | |
| 15 | $t = get_t(); | |
| 3cf45120 | 16 | $items = array(); |
| 30241683 | 17 | if ($phase == 'runtime') { |
| 3cf45120 DC |
18 | $count = db_query('SELECT count(uid) FROM {users} WHERE data LIKE :as OR data LIKE :iau OR data LIKE :fbu', |
| 19 | array(':as' => '%\"app_specific\"%', | |
| 20 | ':iau' => '%\"is_app_user\"%', | |
| 21 | ':fbu' => '%\"fbu\"%'))->fetchField(); | |
| 30241683 DC |
22 | if ($count) { |
| 23 | $status = array( | |
| 24 | 'title' => $t('Drupal for Facebook obsolete data.'), | |
| 25 | '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.'), | |
| 26 | ); | |
| 27 | $status['value'] = $t('Found %count rows', array('%count' => $count)); | |
| 28 | $status['severity'] = REQUIREMENT_WARNING; | |
| 29 | $items[] = $status; | |
| 30 | } | |
| bde758bc DC |
31 | |
| 32 | ||
| 33 | // Confirm no accounts without authmap. The problem caused by old bug, should only occur on sites that have been upgraded. | |
| 5c53e5e6 | 34 | if (module_exists('fb_user')) { |
| 3cf45120 DC |
35 | $count = db_query('SELECT count(u.uid) FROM {users} u LEFT JOIN {fb_user} a ON u.uid=a.uid WHERE u.name LIKE :fb AND a.uid IS NULL', |
| 36 | array(':fb' => '"%@facebook%"'))->fetchField(); | |
| 5c53e5e6 DC |
37 | if ($count) { |
| 38 | $status = array( | |
| 39 | 'title' => $t('Accounts named NNN@facebook without fb_user map'), | |
| 40 | 'description' => $t('Drupal for Facebook may have failed to create a map entry for these accounts. Please report to the Drupal for Facebook issue queue, we are working on a fix.'), | |
| 41 | 'value' => $count, | |
| 42 | 'severity' => REQUIREMENT_WARNING, | |
| 43 | ); | |
| 44 | $items[] = $status; | |
| 45 | } | |
| bde758bc | 46 | } |
| 30241683 | 47 | } |
| 19092d2f | 48 | |
| 30241683 DC |
49 | // Test if json extensions are loaded. |
| 50 | if (defined('SERVICES_JSON_SLICE')) { // defined in facebook's json wrapper, which is not compatible with PHP's JSON extensions. | |
| 51 | $items[] = array( | |
| 52 | 'title' => $t('JSON extension for PHP'), | |
| 53 | 'severity' => REQUIREMENT_ERROR, | |
| 54 | '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')), | |
| 55 | ); | |
| 56 | } | |
| 19092d2f DC |
57 | |
| 58 | ||
| 30241683 DC |
59 | // clean url sanity check |
| 60 | if (!variable_get('clean_url', FALSE) && module_exists('fb_canvas') && $phase == 'runtime') { | |
| 19092d2f | 61 | $message = |
| 30241683 DC |
62 | $items[] = array( |
| 63 | 'title' => $t('Clean URLs'), | |
| 64 | 'severity' => REQUIREMENT_ERROR, | |
| 65 | 'description' => $t('Drupal for Facebook will not function properly until <a href=!url>clean URLs</a> are turned on.', | |
| 66 | array('!url' => url('admin/settings/clean-urls'))), | |
| 67 | ); | |
| 68 | } | |
| 19092d2f | 69 | |
| 30241683 DC |
70 | if (!count($items) && $phase == 'runtime') { |
| 71 | $items[] = array( | |
| 72 | 'title' => $t('Drupal for Facebook Devel'), | |
| 73 | 'value' => $t('No worries'), | |
| 74 | 'description' => $t('All sanity checks OK.'), | |
| 75 | ); | |
| 76 | } | |
| 77 | return $items; | |
| 78 | } | |
| 79 | ||
| 6c70d7d2 DC |
80 | /** |
| 81 | * Implements hook_uninstall(). | |
| 82 | */ | |
| 3cf45120 | 83 | // TODO AVA Confirm this query |
| 6c70d7d2 | 84 | function fb_devel_uninstall() { |
| 339cba46 | 85 | db_query("DELETE FROM {block} WHERE module = 'fb_devel'"); |
| 6c70d7d2 | 86 | } |