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

Diff of /contributions/modules/wghtml/wghtml.install

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

revision 1.1, Sun Feb 25 02:47:51 2007 UTC revision 1.1.2.1, Sun Feb 25 02:47:51 2007 UTC
# Line 0  Line 1 
1    <?php
2    // $Id: wghtml.install,v 1.8 2006/11/05 13:31:57 keve Exp $
3    
4    /**
5     *  Implementations of hook_update (called by update.php)
6     */
7    
8    // Update#1: better table structure
9    function xwghtml_update_1() {
10      return false;
11    }
12    
13    /**
14     * Implementation of hook_install.
15     * Adding tables to database: 'term_access', 'term_access_defaults'
16     */
17    function wghtml_install() {
18    
19      $success = db_query("CREATE TABLE {wghtml_pages} (
20        pageId int unsigned NOT NULL auto_increment,
21        identity varchar(32) NOT NULL default '',
22        PRIMARY KEY  (pageId),
23        KEY identity (identity)
24        )
25      ");
26      $success && drupal_set_message(t('wgHTML has created the wghtml_pages table.'));
27    
28      $success = $success && db_query("CREATE TABLE {wghtml_versions} (
29        pageId int unsigned NOT NULL default '0',
30        version int NOT NULL default '0',
31        perm_area varchar(32) default NULL,
32        raw mediumtext,
33        title text,
34        head text,
35        body mediumtext,
36        bodyattrib text,
37        linkto text,
38        signature bigint unsigned default NULL,
39        cachetime bigint unsigned default NULL,
40        PRIMARY KEY (pageId,version)
41        )
42      ");
43      $success && drupal_set_message(t('wgHTML has created the wghtml_versions table.'));
44    
45      // Notify of changes
46      if ($success) {
47        drupal_set_message(t('wgHTML module installed tables successfully.'));
48      }
49      else {
50        drupal_set_message(t('The installation of wgHTML module was unsuccessful.'), 'error');
51      }
52    }
53    
54    function wghtml_uninstall() {
55      $success = db_query('DROP TABLE {wghtml_pages}');
56      $success && drupal_set_message(t('wgHTML has deleted the wghtml_pages table.'));
57      $success = $success && db_query('DROP TABLE {wghtml_versions}');
58      $success && drupal_set_message(t('wgHTML has deleted the wghtml_versions table.'));
59      //variable_del('wghtml_enabled');
60    
61      if ($success) {
62        drupal_set_message(t('wgHTML has been successfully uninstalled.'));
63        return TRUE;
64      }
65      else {
66        drupal_set_message(t('There was a problem with the uninstallation of wgHTML.'), 'error');
67        return FALSE;
68      }
69    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

  ViewVC Help
Powered by ViewVC 1.1.2