web/drupal/modules/aggregator/aggregator.install
branchdrupal
changeset 74 0ff3ba646492
equal deleted inserted replaced
73:fcf75e232c5b 74:0ff3ba646492
       
     1 <?php
       
     2 // $Id: aggregator.install,v 1.14.2.2 2009/01/06 15:46:36 goba Exp $
       
     3 
       
     4 /**
       
     5  * Implementation of hook_install().
       
     6  */
       
     7 function aggregator_install() {
       
     8   // Create tables.
       
     9   drupal_install_schema('aggregator');
       
    10 }
       
    11 
       
    12 /**
       
    13  * Implementation of hook_uninstall().
       
    14  */
       
    15 function aggregator_uninstall() {
       
    16   // Remove tables.
       
    17   drupal_uninstall_schema('aggregator');
       
    18 
       
    19   variable_del('aggregator_allowed_html_tags');
       
    20   variable_del('aggregator_summary_items');
       
    21   variable_del('aggregator_clear');
       
    22   variable_del('aggregator_category_selector');
       
    23 }
       
    24 
       
    25 /**
       
    26  * Implementation of hook_schema().
       
    27  */
       
    28 function aggregator_schema() {
       
    29   $schema['aggregator_category'] = array(
       
    30     'description' => 'Stores categories for aggregator feeds and feed items.',
       
    31     'fields' => array(
       
    32       'cid'  => array(
       
    33         'type' => 'serial',
       
    34         'not null' => TRUE,
       
    35         'description' => 'Primary Key: Unique aggregator category ID.',
       
    36       ),
       
    37       'title' => array(
       
    38         'type' => 'varchar',
       
    39         'length' => 255,
       
    40         'not null' => TRUE,
       
    41         'default' => '',
       
    42         'description' => 'Title of the category.',
       
    43       ),
       
    44       'description' => array(
       
    45         'type' => 'text',
       
    46         'not null' => TRUE,
       
    47         'size' => 'big',
       
    48         'description' => 'Description of the category',
       
    49       ),
       
    50       'block' => array(
       
    51         'type' => 'int',
       
    52         'not null' => TRUE,
       
    53         'default' => 0,
       
    54         'size' => 'tiny',
       
    55         'description' => 'The number of recent items to show within the category block.',
       
    56       )
       
    57     ),
       
    58     'primary key' => array('cid'),
       
    59     'unique keys' => array('title' => array('title')),
       
    60   );
       
    61 
       
    62   $schema['aggregator_category_feed'] = array(
       
    63     'description' => 'Bridge table; maps feeds to categories.',
       
    64     'fields' => array(
       
    65       'fid' => array(
       
    66         'type' => 'int',
       
    67         'not null' => TRUE,
       
    68         'default' => 0,
       
    69         'description' => "The feed's {aggregator_feed}.fid.",
       
    70       ),
       
    71       'cid' => array(
       
    72         'type' => 'int',
       
    73         'not null' => TRUE,
       
    74         'default' => 0,
       
    75         'description' => 'The {aggregator_category}.cid to which the feed is being assigned.',
       
    76       )
       
    77     ),
       
    78     'primary key' => array('cid', 'fid'),
       
    79     'indexes' => array('fid' => array('fid')),
       
    80   );
       
    81 
       
    82   $schema['aggregator_category_item'] = array(
       
    83     'description' => 'Bridge table; maps feed items to categories.',
       
    84     'fields' => array(
       
    85       'iid' => array(
       
    86         'type' => 'int',
       
    87         'not null' => TRUE,
       
    88         'default' => 0,
       
    89         'description' => "The feed item's {aggregator_item}.iid.",
       
    90       ),
       
    91       'cid' => array(
       
    92         'type' => 'int',
       
    93         'not null' => TRUE,
       
    94         'default' => 0,
       
    95         'description' => 'The {aggregator_category}.cid to which the feed item is being assigned.',
       
    96       )
       
    97     ),
       
    98     'primary key' => array('cid', 'iid'),
       
    99     'indexes' => array('iid' => array('iid')),
       
   100   );
       
   101 
       
   102   $schema['aggregator_feed'] = array(
       
   103     'description' => 'Stores feeds to be parsed by the aggregator.',
       
   104     'fields' => array(
       
   105       'fid' => array(
       
   106         'type' => 'serial',
       
   107         'not null' => TRUE,
       
   108         'description' => 'Primary Key: Unique feed ID.',
       
   109       ),
       
   110       'title' => array(
       
   111         'type' => 'varchar',
       
   112         'length' => 255,
       
   113         'not null' => TRUE,
       
   114         'default' => '',
       
   115         'description' => 'Title of the feed.',
       
   116       ),
       
   117       'url' => array(
       
   118         'type' => 'varchar',
       
   119         'length' => 255,
       
   120         'not null' => TRUE,
       
   121         'default' => '',
       
   122         'description' => 'URL to the feed.',
       
   123       ),
       
   124       'refresh' => array(
       
   125         'type' => 'int',
       
   126         'not null' => TRUE,
       
   127         'default' => 0,
       
   128         'description' => 'How often to check for new feed items, in seconds.',
       
   129       ),
       
   130       'checked' => array(
       
   131         'type' => 'int',
       
   132         'not null' => TRUE,
       
   133         'default' => 0,
       
   134         'description' => 'Last time feed was checked for new items, as Unix timestamp.',
       
   135       ),
       
   136       'link' => array(
       
   137         'type' => 'varchar',
       
   138         'length' => 255,
       
   139         'not null' => TRUE,
       
   140         'default' => '',
       
   141         'description' => 'The parent website of the feed; comes from the &lt;link&gt; element in the feed.',
       
   142       ),
       
   143       'description' => array(
       
   144         'type' => 'text',
       
   145         'not null' => TRUE,
       
   146         'size' => 'big',
       
   147         'description' => "The parent website's description; comes from the &lt;description&gt; element in the feed.",
       
   148       ),
       
   149       'image' => array(
       
   150         'type' => 'text',
       
   151         'not null' => TRUE,
       
   152         'size' => 'big',
       
   153         'description' => 'An image representing the feed.',
       
   154       ),
       
   155       'etag' => array(
       
   156         'type' => 'varchar',
       
   157         'length' => 255,
       
   158         'not null' => TRUE,
       
   159         'default' => '',
       
   160         'description' => 'Entity tag HTTP response header, used for validating cache.',
       
   161       ),
       
   162       'modified' => array(
       
   163         'type' => 'int',
       
   164         'not null' => TRUE,
       
   165         'default' => 0,
       
   166         'description' => 'When the feed was last modified, as a Unix timestamp.',
       
   167       ),
       
   168       'block' => array(
       
   169         'type' => 'int',
       
   170         'not null' => TRUE,
       
   171         'default' => 0,
       
   172         'size' => 'tiny',
       
   173         'description' => "Number of items to display in the feed's block.",
       
   174       )
       
   175     ),
       
   176     'primary key' => array('fid'),
       
   177     'unique keys' => array(
       
   178       'url'  => array('url'),
       
   179       'title' => array('title'),
       
   180     ),
       
   181   );
       
   182 
       
   183   $schema['aggregator_item'] = array(
       
   184     'description' => 'Stores the individual items imported from feeds.',
       
   185     'fields' => array(
       
   186       'iid'  => array(
       
   187         'type' => 'serial',
       
   188         'not null' => TRUE,
       
   189         'description' => 'Primary Key: Unique ID for feed item.',
       
   190       ),
       
   191       'fid' => array(
       
   192         'type' => 'int',
       
   193         'not null' => TRUE,
       
   194         'default' => 0,
       
   195         'description' => 'The {aggregator_feed}.fid to which this item belongs.',
       
   196       ),
       
   197       'title' => array(
       
   198         'type' => 'varchar',
       
   199         'length' => 255,
       
   200         'not null' => TRUE,
       
   201         'default' => '',
       
   202         'description' => 'Title of the feed item.',
       
   203       ),
       
   204       'link' => array(
       
   205         'type' => 'varchar',
       
   206         'length' => 255,
       
   207         'not null' => TRUE,
       
   208         'default' => '',
       
   209         'description' => 'Link to the feed item.',
       
   210       ),
       
   211       'author' => array(
       
   212         'type' => 'varchar',
       
   213         'length' => 255,
       
   214         'not null' => TRUE,
       
   215         'default' => '',
       
   216         'description' => 'Author of the feed item.',
       
   217       ),
       
   218       'description' => array(
       
   219         'type' => 'text',
       
   220         'not null' => TRUE,
       
   221         'size' => 'big',
       
   222         'description' => 'Body of the feed item.',
       
   223       ),
       
   224       'timestamp' => array(
       
   225         'type' => 'int',
       
   226         'not null' => FALSE,
       
   227         'description' => 'Post date of feed item, as a Unix timestamp.',
       
   228       ),
       
   229       'guid' => array(
       
   230         'type' => 'varchar',
       
   231         'length' => 255,
       
   232         'not null' => FALSE,
       
   233         'description' => 'Unique identifier for the feed item.',
       
   234       )
       
   235     ),
       
   236     'primary key' => array('iid'),
       
   237     'indexes' => array('fid' => array('fid')),
       
   238   );
       
   239 
       
   240   return $schema;
       
   241 }