fb.install in Drupal for Facebook 6.2
Same filename and directory in other branches
Install file to support fb.module.
File
fb.installView source
<?php
/**
* @file
* Install file to support fb.module.
*
*/
/**
* Implementation of hook_requirements().
*/
function fb_requirements($phase) {
$t = get_t();
$items = array();
// Disable these checks at install time, because failure then causes more
// problems, due to module dependencies and Drupal's poor handling of
// requirement errors.
if ($phase != 'runtime') {
return $items;
}
$status = array(
'title' => $t('Drupal for Facebook Settings'),
);
if (function_exists('fb_settings')) {
if ($phase == 'runtime') {
$status['value'] = $t('Included');
}
$status['severity'] = REQUIREMENT_OK;
}
else {
if ($phase == 'runtime') {
$status['value'] = $t('Not included');
}
$status['severity'] = REQUIREMENT_ERROR;
$path = drupal_get_path('module', 'fb');
if (!$path) {
// Not set during install.php
$path = 'modules/fb';
}
$status['description'] = $t('Add something like <strong>include "%path";</strong> to your settings.php.', array(
'%path' => $path . '/fb_settings.inc',
));
}
$items[] = $status;
$status = array(
'title' => $t('Facebook Client API'),
);
$fb_platform = variable_get('fb_api_file', 'facebook-platform/php/facebook.php');
if (class_exists('Facebook')) {
$status['description'] = $t('Facebook Client API loaded.');
$status['severity'] = REQUIREMENT_OK;
$status['value'] = $t('Loaded');
}
elseif (include $fb_platform) {
// include() better than file_exists().
$status['description'] = $t('Facebook client API found at %path', array(
'%path' => $fb_platform,
));
$status['severity'] = REQUIREMENT_OK;
if ($phase == 'runtime') {
$status['value'] = $t('Found');
}
}
else {
$status['description'] = $t('Facebook client API not found. See modules/fb/README.txt');
$status['severity'] = REQUIREMENT_ERROR;
if ($phase == 'runtime') {
$status['value'] = $t('Not found');
}
}
$items[] = $status;
return $items;
}
function fb_install() {
_fb_install_set_weight();
drupal_set_message(st('Drupal for Facebook modules enabled. Be sure to install facebook\'s client libraries and modify your settings.php! Read modules/fb/README.txt and <a href="!doc_url" target="_blank">the online documentation for Drupal for Facebook</a> for details.', array(
'!doc_url' => 'http://drupal.org/node/195035',
)));
}
function fb_uninstall() {
db_query("DELETE FROM {variable} WHERE name LIKE 'fb_%'");
}
function _fb_install_set_weight() {
db_query("UPDATE {system} SET weight=-2 WHERE name='fb'");
}
// No longer needed with new fb_session.inc. To be deleted! XXX
function _fb_install_alter_session_table() {
// Make sessions.sid column large enough for Facebook's session_keys.
if (variable_get('fb_session_long_keys', TRUE)) {
$ret = array();
$spec = array(
'description' => "Primary key: A session ID. The value is generated by PHP's Session API.",
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
);
db_change_field($ret, 'sessions', 'sid', 'sid', $spec);
}
}
function fb_update_6000() {
$ret = array();
_fb_install_alter_session_table();
return $ret;
}
function fb_update_6001() {
$ret = array();
$message = 'IMPORTANT: Drupal for Facebook modules have moved around! Check your <em>modules/fb/</em> directory, and make sure you do not have duplicates of fb_feed.module or fb_views.module. If so, delete the entire <em>modules/fb/</em> directory and re-install.';
drupal_set_message($message);
watchdog('fb', $message);
return $ret;
}
function fb_update_6002() {
$ret = array();
$message = 'IMPORTANT: Drupal for Facebook connect URLs have changed. You must manually edit each of your applications. Pressing the save button will update the connect URL property.';
drupal_set_message($message);
watchdog('fb', $message);
return $ret;
}
Functions
Name | Description |
---|---|
fb_install | |
fb_requirements | Implementation of hook_requirements(). |
fb_uninstall | |
fb_update_6000 | |
fb_update_6001 | |
fb_update_6002 | |
_fb_install_alter_session_table | |
_fb_install_set_weight |