123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- <?php
- /**
- * @file
- * Install, update and uninstall functions for the twitter module.
- *
- */
- /**
- * Implements hook_schema().
- */
- function twitter_schema() {
- $schema['twitter'] = array(
- 'description' => "Stores individual Twitter posts.",
- 'fields' => array(
- 'twitter_id' => array(
- 'description' => "Unique identifier for each {twitter} post.",
- 'type' => 'numeric',
- 'unsigned' => TRUE,
- 'precision' => 20,
- 'scale' => 0,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'screen_name' => array(
- 'description' => "Screen Name of the {twitter_account} user.",
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'created_at' => array(
- 'description' => "Date and time the {twitter} post was created.",
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'created_time' => array(
- 'description' => "A duplicate of {twitter}.created_at in UNIX timestamp format.",
- 'type' => 'int',
- 'not null' => TRUE,
- ),
- 'text' => array(
- 'description' => "The text of the {twitter} post.",
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- ),
- 'source' => array(
- 'description' => "The application that created the {twitter} post.",
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- ),
- 'in_reply_to_status_id' => array(
- 'description' => "Unique identifier of a status this {twitter} post was replying to.",
- 'type' => 'numeric',
- 'unsigned' => TRUE,
- 'precision' => 20,
- 'scale' => 0,
- 'not null' => FALSE,
- ),
- 'in_reply_to_user_id' => array(
- 'description' => "Unique identifier for the {twitter_account} this post was replying to.",
- 'type' => 'numeric',
- 'unsigned' => TRUE,
- 'precision' => 20,
- 'scale' => 0,
- 'not null' => FALSE,
- ),
- 'in_reply_to_screen_name' => array(
- 'description' => "Screen name of the {twitter} user this post was replying to.",
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- ),
- 'truncated' => array(
- 'description' => "Boolean flag indicating whether the {twitter} status was cut off to fit in the 140 character limit.",
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'indexes' => array('screen_name' => array('screen_name')),
- 'primary key' => array('twitter_id'),
- );
- $schema['twitter_account'] = array(
- 'description' => "Stores information on specific Twitter user accounts.",
- 'fields' => array(
- 'twitter_uid' => array(
- 'description' => "The unique identifier of the {twitter_account}.",
- 'type' => 'numeric',
- 'unsigned' => TRUE,
- 'precision' => 20,
- 'scale' => 0,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'uid' => array(
- 'description' => "The {users}.uid of the owner of this account",
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'size' => 'big',
- 'not null' => TRUE,
- ),
- 'host' => array(
- 'description' => 'The host for this account can be a laconi.ca instance',
- 'type' => 'varchar',
- 'length' => 255,
- ),
- 'screen_name' => array(
- 'description' => "The unique login name of the {twitter_account} user.",
- 'type' => 'varchar',
- 'length' => 255,
- ),
- 'password' => array(
- 'description' => "The password for the Twitter account.",
- 'type' => 'varchar',
- 'length' => 64,
- ),
- 'oauth_token' => array(
- 'description' => 'The token_key for oauth-based access.',
- 'type' => 'varchar',
- 'length' => 64,
- ),
- 'oauth_token_secret' => array(
- 'description' => 'The token_secret for oauth-based access.',
- 'type' => 'varchar',
- 'length' => 64,
- ),
- 'name' => array(
- 'description' => "The full name of the {twitter_account} user.",
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'description' => array(
- 'description' => "The description/biography associated with the {twitter_account}.",
- 'type' => 'varchar',
- 'length' => 255,
- ),
- 'location' => array(
- 'description' => "The location of the {twitter_account}'s owner.",
- 'type' => 'varchar',
- 'length' => 255,
- ),
- 'followers_count' => array(
- 'description' => "The number of users following this {twitter_account}.",
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'friends_count' => array(
- 'description' => "The number of users this {twitter_account} is following.",
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'statuses_count' => array(
- 'description' => "The total number of status updates performed by a user, excluding direct messages sent.",
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'favourites_count' => array(
- 'description' => "The number of statuses a user has marked as favorite.",
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'url' => array(
- 'description' => "The url of the {twitter_account}'s home page.",
- 'type' => 'varchar',
- 'length' => 255,
- ),
- 'profile_image_url' => array(
- 'description' => "The url of the {twitter_account}'s profile image.",
- 'type' => 'varchar',
- 'length' => 255,
- ),
- 'protected' => array(
- 'description' => "Boolean flag indicating whether the {twitter_account}'s posts are publicly accessible.",
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'profile_background_color' => array(
- 'description' => "hex RGB value for a user's background color",
- 'type' => 'varchar',
- 'length' => 6,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'profile_text_color' => array(
- 'description' => "hex RGB value for a user's text color",
- 'type' => 'varchar',
- 'length' => 6,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'profile_link_color' => array(
- 'description' => "hex RGB value for a user's link color",
- 'type' => 'varchar',
- 'length' => 6,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'profile_sidebar_fill_color' => array(
- 'description' => "hex RGB value for a user's sidebar color",
- 'type' => 'varchar',
- 'length' => 6,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'profile_sidebar_border_color' => array(
- 'description' => "hex RGB value for a user's border color",
- 'type' => 'varchar',
- 'length' => 6,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'profile_background_image_url' => array(
- 'description' => "The url of the {twitter_account}'s profile image.",
- 'type' => 'varchar',
- 'length' => 255,
- ),
- 'profile_background_tile' => array(
- 'description' => "Boolean indicating if a user's background is tiled.",
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 1,
- ),
- 'verified' => array(
- 'description' => "Indicates if a user is verified.",
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 1,
- ),
- 'created_at' => array(
- 'description' => "Date and time the {twitter_account} was created.",
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'created_time' => array(
- 'description' => "A duplicate of {twitter_account}.created_at in UNIX timestamp format.",
- 'type' => 'int',
- 'not null' => TRUE,
- ),
- 'utc_offset' => array(
- 'description' => "A duplicate of {twitter_account}.created_at in UNIX timestamp format.",
- 'type' => 'int',
- 'not null' => TRUE,
- ),
- 'import' => array(
- 'description' => "Boolean flag indicating whether the {twitter_user}'s posts should be pulled in by the site.",
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 1,
- ),
- 'last_refresh' => array(
- 'description' => "A UNIX timestamp marking the date Twitter statuses were last fetched on.",
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'is_global' => array(
- 'description' => "Boolean flag indicating if this account is available for global use",
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'indexes' => array('screen_name' => array('screen_name')),
- 'primary key' => array('twitter_uid'),
- );
- return $schema;
- }
- /**
- * Implements hook_install().
- */
- function twitter_install() {
- // Set the weight to 3, making it heavier than Pathauto.
- db_update('system')
- ->fields(array(
- 'weight' => 3,
- ))
- ->condition('type', 'module')
- ->condition('name', 'twitter')
- ->execute();
- }
- /**
- * Implements hook_uninstall().
- */
- function twitter_uninstall() {
- // Remove variables
- variable_del('twitter_import');
- variable_del('twitter_expire');
- variable_del('twitter_consumer_key');
- variable_del('twitter_consumer_secret');
- variable_del('twitter_post_types');
- variable_del('twitter_host');
- variable_del('twitter_post_default_format');
- variable_del('twitter_signin_button');
- variable_del('twitter_signin_register');
- }
- /**
- * Implements hook_update_last_removed().
- */
- function twitter_update_last_removed() {
- return 6005;
- }
|