1 |
6657531f
|
Andreas Kohlbecker
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Install, update and uninstall functions for the cdm_api module.
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
/**
|
8 |
|
|
* Implements hook_schema().
|
9 |
|
|
* The drupal_(un)install_schema functions are called automatically in D7.
|
10 |
|
|
*/
|
11 |
|
|
function cdm_api_schema() {
|
12 |
|
|
$schema['cache_cdm_ws'] = array(
|
13 |
|
|
'fields' => array(
|
14 |
|
|
'cid' => array(
|
15 |
|
|
'description' => 'Primary Key: Unique cache ID.',
|
16 |
|
|
'type' => 'varchar',
|
17 |
|
|
'length' => '333',
|
18 |
|
|
'not null' => TRUE,
|
19 |
|
|
'default' => '',
|
20 |
|
|
),
|
21 |
|
|
'data' => array(
|
22 |
|
|
'description' => 'The data to cache.',
|
23 |
|
|
'type' => 'blob',
|
24 |
|
|
'size' => 'big',
|
25 |
|
|
'not null' => FALSE,
|
26 |
|
|
),
|
27 |
|
|
'expire' => array(
|
28 |
|
|
'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
|
29 |
|
|
'type' => 'int',
|
30 |
|
|
'not null' => TRUE,
|
31 |
|
|
'default' => 0,
|
32 |
|
|
'disp-width' => '11',
|
33 |
|
|
),
|
34 |
|
|
'created' => array(
|
35 |
|
|
'description' => 'Unix timestamp indicating when the cache entry was created.',
|
36 |
|
|
'type' => 'int',
|
37 |
|
|
'not null' => TRUE,
|
38 |
|
|
'default' => 0,
|
39 |
|
|
'disp-width' => '11',
|
40 |
|
|
),
|
41 |
|
|
'serialized' => array(
|
42 |
|
|
'description' => 'A flag to indicate whether content is serialized by Drupal (1) or not (0).',
|
43 |
|
|
'type' => 'int',
|
44 |
|
|
'size' => 'small',
|
45 |
|
|
'not null' => FALSE,
|
46 |
|
|
),
|
47 |
|
|
),
|
48 |
|
|
'primary key' => array('cid'),
|
49 |
|
|
'indexes' => array(
|
50 |
|
|
'expire' => array('expire'),
|
51 |
|
|
),
|
52 |
|
|
// Important, since the 'cid' field is too big to create a key on in INNODB.
|
53 |
|
|
// InnoDB allows a max. key length of 767 bytes, MyISAM 1000 bytes, which is
|
54 |
|
|
// for utf8 (333*3)+1, so 333 characters max. instead of 255 chars.
|
55 |
|
|
'mysql_engine' => 'MyISAM',
|
56 |
|
|
);
|
57 |
|
|
|
58 |
|
|
// @Comment WA: please describe the fields.
|
59 |
|
|
$schema['node_cdm'] = array(
|
60 |
|
|
'fields' => array(
|
61 |
|
|
'nid' => array(
|
62 |
|
|
'type' => 'int',
|
63 |
|
|
'not null' => TRUE,
|
64 |
|
|
'disp-width' => '11',
|
65 |
|
|
),
|
66 |
|
|
'wsuri' => array(
|
67 |
|
|
'type' => 'varchar',
|
68 |
|
|
'length' => '255',
|
69 |
|
|
'not null' => FALSE,
|
70 |
|
|
),
|
71 |
|
|
'hash' => array(
|
72 |
|
|
'type' => 'char',
|
73 |
|
|
'length' => '32',
|
74 |
|
|
'not null' => TRUE,
|
75 |
|
|
),
|
76 |
|
|
'cdmtype' => array(
|
77 |
|
|
'type' => 'varchar',
|
78 |
|
|
'length' => '255',
|
79 |
|
|
'not null' => FALSE,
|
80 |
|
|
),
|
81 |
|
|
'uuid' => array(
|
82 |
|
|
'type' => 'varchar',
|
83 |
|
|
'length' => '255',
|
84 |
|
|
'not null' => TRUE,
|
85 |
|
|
'default' => '',
|
86 |
|
|
),
|
87 |
|
|
),
|
88 |
|
|
'primary key' => array('hash'),
|
89 |
|
|
);
|
90 |
|
|
|
91 |
|
|
return $schema;
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
/**
|
95 |
|
|
* Update D5 cache table to match Drupal 7 cache table columns.
|
96 |
|
|
*/
|
97 |
|
|
function cdm_api_update_7000() {
|
98 |
|
|
$schema = cdm_api_schema();
|
99 |
|
|
|
100 |
|
|
// No need to use db_change_field() here.
|
101 |
|
|
// We simply drop and recreate the cache tables to start clean.
|
102 |
|
|
db_drop_table('cache_cdm_ws');
|
103 |
|
|
db_create_table('cache_cdm_ws', $schema['cache_cdm_ws']);
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
/**
|
108 |
|
|
* Implements hook_requirements().
|
109 |
|
|
*
|
110 |
|
|
* This hook, like all others dealing with installation and updates, must
|
111 |
|
|
* reside in the .install file, or it will not properly abort the installation
|
112 |
|
|
* of the module if a critical requirement is missing.
|
113 |
|
|
*/
|
114 |
|
|
function cdm_api_requirements() {
|
115 |
|
|
$requirements['cdm_api'] = array(
|
116 |
3db2866c
|
Andreas Kohlbecker
|
'title' => 'CDM API'
|
117 |
6657531f
|
Andreas Kohlbecker
|
);
|
118 |
|
|
|
119 |
|
|
return $requirements;
|
120 |
|
|
}
|