You are here

function fb_user_install in Drupal for Facebook 5

Same name and namespace in other branches
  1. 5.2 fb_user.install \fb_user_install()
  2. 6.3 fb_user.install \fb_user_install()
  3. 6.2 fb_user.install \fb_user_install()
  4. 7.3 fb_user.install \fb_user_install()
1 call to fb_user_install()
fb_user_update_1 in ./fb_user.install

File

./fb_user.install, line 3

Code

function fb_user_install() {
  global $db_type;
  if ($db_type == 'mysqli' || $db_type == 'mysql') {
    $query[] = <<<QUERY
CREATE TABLE IF NOT EXISTS {fb_user_app} (
apikey varchar(128) NOT NULL,
fbu int(11) unsigned NOT NULL,
uid int(11) unsigned DEFAULT NULL,
added int(4) unsigned NOT NULL,
time_cron int(11) unsigned NOT NULL,
time_access int(11) unsigned NOT NULL,
session_key varchar(128) NOT NULL,
session_key_expires int(11) unsigned NOT NULL,
PRIMARY KEY (apikey, fbu),
INDEX (uid),
UNIQUE INDEX (uid, apikey)
) /*!40100 DEFAULT CHARACTER SET UTF8 */;
QUERY;
  }
  else {

    // TODO: handle other databases
    drupal_set_message(t('Unable to install fb_user database schema to a database of type: %type', array(
      '%type' => $db_type,
    )), 'error');
  }
  foreach ($query as $q) {
    $status = db_query($q);
    if (!$status) {
      drupal_set_message(t('Error installing fb_user: %error %query', array(
        '%query' => '<pre>' . $q . '</pre>',
        '%error' => db_error(),
      )), 'error');
    }
  }
}