/[drupal]/contributions/modules/news_page/news_page.install
ViewVC logotype

Diff of /contributions/modules/news_page/news_page.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3, Tue Jul 24 00:54:07 2007 UTC revision 1.4, Sat May 9 23:54:37 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: news_page.install,v 1.1.2.2 2007/01/14 03:22:34 MegaGrunt Exp $  // $Id: news_page.install,v 1.2.2.3 2009/04/29 21:29:58 MegaGrunt Exp $
3    
4  /**  /**
5   * Implementation of hook_install()   * Implementation of hook_install()
6   */   */
7  function news_page_install() {  function news_page_install() {
8    switch ($GLOBALS['db_type']) {    // Create tables.
9      case 'mysql':    drupal_install_schema('news_page');
     case 'mysqli':  
           $query1 = db_query("CREATE TABLE {news_page} (  
                 nid int(10) unsigned NOT NULL default '0',  
                 include varchar(255) NOT NULL default '',  
                 cid int(10) unsigned NOT NULL default '0',  
                 max_items int(11) NOT NULL default '0',  
                 search text,  
                 PRIMARY KEY (nid)  
                 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");  
   
           if (!empty($query1)) {  
             $created = TRUE;  
           }  
   
           break;  
   }  
   
   if ($created) {  
     drupal_set_message(t('News Page module installed successfully.'));  
   }  
   else {  
     drupal_set_message(t('Table installation for the News Page module was unsuccessful. The tables may need to be installed by hand. See news_page.install file for a list of the installation queries.'), 'error');  
   }  
   
   return;  
10  }  }
11    
12  /**  /**
13    * Implementation of hook_schema().
14    */
15    function news_page_schema() {
16      $schema['news_page'] = array(
17        'fields' => array(
18            'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => 10, 'description' => t("nid of the news page node.")),
19            'include' => array('type' => 'varchar', 'length' => 255, 'description' => t("Keywords to use for filtering.")),
20            'cid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => 10, 'description' => t("ID of feed category.")),
21            'max_items' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => 10, 'description' => t("Maximum number of items to include on news page.")),
22            'search' => array('type' => 'text', 'size' => 'big', 'description' => t("Cache of the search SQL.")),
23        ),
24        'indexes' => array('nid' => array('nid')),
25        'primary key' => array('nid'),
26      );
27    
28      return $schema;
29    }
30    
31    /**
32   * Updates existing tables from early 4.6 install and add "search" field.   * Updates existing tables from early 4.6 install and add "search" field.
33   */   */
34  function news_page_update_1() {  function news_page_update_1() {
# Line 45  function news_page_update_1() { Line 39  function news_page_update_1() {
39    $items[] = update_sql('ALTER TABLE {news_page} ADD search text');    $items[] = update_sql('ALTER TABLE {news_page} ADD search text');
40    
41    return $items;    return $items;
42    }
43    
44    /**
45     * Implementation of hook_uninstall().
46     */
47    function news_page_uninstall() {
48      drupal_uninstall_schema('news_page');
49      variable_del('news_page_link_prepend');
50      variable_del('news_page_channel_description');
51  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2