. * You can contact New Signature by electronic mail at labs@newsignature.com �or- by U.S. Postal Service at 1100 H St. NW, Suite 940, Washington, DC 20005. */ /** * @file * Install and uninstall functions for the Most Popular module. */ /** * Implements hook_schema(). */ function mostpopular_schema() { $schema = array(); $schema['mostpopular_block'] = array( 'description' => 'Stores configuration info for each mostpopular block', 'fields' => array( 'bid' => array( 'description' => 'The block ID of the block', 'type' => 'serial', 'not null' => TRUE, 'unsigned' => TRUE, ), 'name' => array( 'description' => 'The machine name for this block', 'type' => 'varchar', 'length' => 32, ), 'title' => array( 'description' => 'The title to display for the block', 'type' => 'varchar', 'length' => 255, ), 'count' => array( 'description' => 'The maximum number of results to display for any service', 'type' => 'int', 'default' => 5, ), 'remote_bid' => array( 'description' => 'If this block references another block in a remote database, this is the ID of that block', 'type' => 'int', 'unsigned' => TRUE, ), 'data' => array( 'description' => 'Any additional parameters for the block, serialized', 'type' => 'text', 'size' => 'medium', 'serialize' => TRUE, ), ), 'primary key' => array( 'bid' ), ); $schema['mostpopular_service'] = array( 'description' => 'Stores configuration information about the most popular services', 'fields' => array( 'sid' => array( 'type' => 'serial', 'not null' => TRUE, 'unsigned' => TRUE, ), 'bid' => array( 'description' => 'The block in which this service appears', 'type' => 'int', 'unsigned' => TRUE, ), 'module' => array( 'description' => 'The module that provides this service', 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, ), 'delta' => array( 'description' => 'The delta of this service within the module (for modules that provide more than one service)', 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, ), 'enabled' => array( 'description' => 'TRUE if this service is enabled, false otherwise', 'type' => 'int', 'size' => 'tiny', 'not null' => TRUE, ), 'status' => array( 'type' => 'int', 'size' => 'small', 'not null' => TRUE, ), 'name' => array( 'description' => "The name of the provided service (so we don't have to look it up every time)", 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, ), 'title' => array( 'description' => 'The title to show users for this service', 'type' => 'varchar', 'length' => 32, 'not null' => FALSE, ), 'data' => array( 'description' => 'Any additional parameters for the service, serialized', 'type' => 'text', 'size' => 'medium', 'serialize' => TRUE, ), 'weight' => array( 'type' => 'int', 'not null' => TRUE, ), ), 'primary key' => array( 'sid' ), 'unique keys' => array( ), 'indexes' => array( 'block' => array( 'bid', 'module', 'delta' ), 'service' => array( 'module', 'delta', 'bid' ), 'enabled' => array( 'bid', 'enabled' ), ), ); $schema['mostpopular_interval'] = array( 'description' => 'Stores the predefined intervals to fetch for each service within a block', 'fields' => array( 'iid' => array( 'description' => 'The unique ID of the interval', 'type' => 'serial', 'not null' => TRUE, 'unsigned' => TRUE, ), 'bid' => array( 'description' => 'The block in which this interval appears', 'type' => 'int', 'unsigned' => TRUE, ), 'string' => array( 'description' => 'The strototime() date string to define this interval', 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, ), 'title' => array( 'description' => 'The title to display for this interval', 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, ), 'weight' => array( 'type' => 'int', 'not null' => TRUE, ), ), 'primary key' => array( 'iid' ), 'unique keys' => array( 'block' => array( 'bid', 'iid' ), ), 'indexes' => array( 'interval_str' => array( 'string' ), ), ); $schema['mostpopular_last_run'] = array( 'description' => 'Stores the time at which a service was last run over an interval.', 'fields' => array( 'sid' => array( 'description' => 'The service that generated this data', 'type' => 'int', 'not null' => TRUE, 'unsigned' => TRUE, ), 'iid' => array( 'description' => 'The interval to which this data corresponds', 'type' => 'int', 'not null' => TRUE, 'unsigned' => TRUE, ), 'last_run' => array( 'description' => 'The time at which this service was last run', 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'next_run' => array( 'description' => 'The amount of time to wait before refreshing this service again', 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), ), 'primary key' => array( 'sid', 'iid' ), ); $schema['mostpopular_item'] = array( 'description' => 'Stores cached values from the most popular services', 'fields' => array( 'sid' => array( 'description' => 'The service that generated this data', 'type' => 'int', 'not null' => TRUE, 'unsigned' => TRUE, ), 'iid' => array( 'description' => 'The interval to which this data corresponds', 'type' => 'int', 'not null' => TRUE, 'unsigned' => TRUE, ), 'entity_id' => array( 'description' => 'The ID of the entity, if this item is an entity', 'type' => 'int', 'not null' => FALSE, ), 'entity_type' => array( 'description' => 'The type of entity, if this item is an entity', 'type' => 'varchar', 'length' => 32, 'not null' => FALSE, ), 'path' => array( 'description' => 'The Drupal path of this node or page', 'type' => 'varchar', 'length' => 1024, ), 'url' => array( 'description' => 'The URL alias of the node or page', 'type' => 'varchar', 'length' => 2048, ), 'title' => array( 'description' => 'The title of the node or page', 'type' => 'varchar', 'length' => 1024, ), 'count' => array( 'description' => 'The number of occurrences of this URL within the requested time interval', 'type' => 'int', 'not null' => TRUE, ), ), 'primary key' => array( 'sid', 'iid', array('path', 50) ), 'indexes' => array( 'entity' => array( 'entity_type', 'entity_id', 'sid', 'iid' ), 'entity_url' => array( 'entity_type', 'entity_id', array('path', 50), 'sid', 'iid' ), ), ); return $schema; }