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

Contents of /contributions/modules/webfm/webfm.install

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


Revision 1.15 - (show annotations) (download) (as text)
Wed Aug 19 15:35:42 2009 UTC (3 months, 1 week ago) by robmilne
Branch: MAIN
CVS Tags: DRUPAL-6--2-11, DRUPAL-6--2-10, HEAD
Changes since 1.14: +10 -1 lines
File MIME type: text/x-php
Add uninstall of owner column var
Add OG stuff from node 249487
1 <?php
2 // $Id: webfm.install,v 1.14 2008/11/14 20:59:47 robmilne Exp $
3
4 /**
5 * Implementation of hook_install().
6 */
7 function webfm_install(){
8 drupal_install_schema('webfm');
9 }
10
11 /**
12 * Implementation of hook_uninstall().
13 */
14 function webfm_uninstall(){
15 drupal_uninstall_schema('webfm');
16 variable_del('webfm_root_dir');
17 variable_del('webfm_ftp_enable');
18 variable_del('webfm_ftp_root_dir');
19 variable_del('webfm_icon_dir');
20 variable_del('webfm_attach_body');
21 variable_del('webfm_attach_desc');
22 variable_del('webfm_attach_date');
23 variable_del('webfm_attach_size');
24 variable_del('webfm_debug');
25 variable_del('webfm_display_title');
26 variable_del('webfm_display_owner');
27 variable_del('webfm_cron');
28 variable_del('webfm_max_resolution');
29 variable_del('webfm_ie_dd_list_offset');
30 variable_del('webfm_ie_dd_tree_offset');
31 $roles = user_roles(1, 'access webfm');
32 foreach ($roles as $rid => $role) {
33 variable_del('root_dir_'.$rid);
34 variable_del('webfm_extensions_'.$rid);
35 variable_del('webfm_uploadsize_'.$rid);
36 variable_del('webfm_usersize_'.$rid);
37 }
38
39 if (module_exists('og')) {
40 $groups = og_all_groups_options();
41 foreach ($groups as $gid => $group) {
42 variable_del('root_dir_group_'.$gid);
43 }
44 }
45
46 $types = node_get_types();
47 foreach ($types as $type) {
48 if ($type->type)
49 variable_del('webfm_attach_'.$type->type);
50 }
51 variable_del('webfm_file_perm_role');
52 variable_del('webfm_file_perm_mod');
53 variable_del('webfm_file_perm_attach');
54 variable_del('webfm_file_public');
55 variable_del('webfm_date_format');
56 variable_del('webfm_attach_new_window');
57 }
58
59 /**
60 * Implementation of hook_schema().
61 */
62 function webfm_schema(){
63 $schema['webfm_file'] = array(
64 'fields' => array(
65 'fid' => array('type' => 'serial', 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE),
66 'uid' => array('type' => 'int', 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
67 'fpath' => array('type' => 'text', 'size' => 'medium', 'not null' => TRUE),
68 'fsize' => array('type' => 'int', 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
69 'fmime' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
70 'ftitle' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
71 'fdesc' => array('type' => 'text', 'size' => 'normal', 'not null' => TRUE, 'default' => ''),
72 'fcreatedate' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
73 'flang' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
74 'fpublisher' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
75 'fformat' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
76 'fversion' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
77 'perm' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0),
78 'dl_cnt' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
79 ),
80 'primary key' => array('fid'),
81 );
82
83 $schema['webfm_attach'] = array(
84 'fields' => array(
85 'nid' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
86 'fid' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
87 'weight' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
88 'cid' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
89 ),
90 'primary key' => array('nid', 'fid', 'cid' ),
91 );
92 return $schema;
93 }
94
95 /**
96 * Add column for comment id in webfm_attach table.
97 */
98 function webfm_update_1() {
99 $ret = array();
100 // Add the new column to store a comment id.
101 db_add_field($ret, 'webfm_attach', 'cid', array('type' => 'int', 'not null' => TRUE, 'default' => '0'));
102
103 // Make it a primary key.
104 db_drop_primary_key($ret, 'webfm_attach');
105 db_add_primary_key($ret, 'webfm_attach', array('nid', 'cid', 'fid'));
106 return $ret;
107 }

  ViewVC Help
Powered by ViewVC 1.1.2