You are here

flag_actions.install in Flag 5

Flag actions install file.

File

flag_actions.install
View source
<?php

/**
 * @file
 * Flag actions install file.
 */

/**
 * Implementation of hook_install().
 */
function flag_actions_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {flag_actions} (\n        aid int(11) NOT NULL auto_increment,\n        fid smallint(6) default NULL,\n        event varchar(255) default NULL,\n        threshold smallint(6) default NULL,\n        callback varchar(255) NOT NULL default '',\n        parameters longtext NOT NULL,\n        PRIMARY KEY (aid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {flag_actions} (\n        aid serial,\n        fid smallint default NULL,\n        event varchar(255) default NULL,\n        threshold smallint default NULL,\n        callback varchar(255) NOT NULL default '',\n        parameters text NOT NULL,\n        PRIMARY KEY (aid)\n      )");
      break;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function flag_actions_uninstall() {
  db_query("DROP TABLE {flag_actions}");
}

/**
 * We don't support Actions 1.x.
 */
function flag_actions_enable() {
  if (drupal_get_installed_schema_version('actions', TRUE) < 10) {
    drupal_set_message(t("The <em>Flag actions</em> module supports the <a href='@actions-url'>Actions module in its version 2.x</a> only. You are using Actions 1.x and you won't be able to enjoy Flag's actions support.", array(
      '@actions-url' => 'http://drupal.org/project/actions',
    )), 'error');
    module_disable(array(
      'flag_actions',
    ));
  }
}

Functions

Namesort descending Description
flag_actions_enable We don't support Actions 1.x.
flag_actions_install Implementation of hook_install().
flag_actions_uninstall Implementation of hook_uninstall().