1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Install, update and uninstall functions for the twitter_block module.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_schema().
|
10
|
*/
|
11
|
function twitter_block_schema() {
|
12
|
$schema['twitter_block'] = array(
|
13
|
'description' => 'The table for storing twitter blocks.',
|
14
|
'fields' => array(
|
15
|
'bid' => array(
|
16
|
'type' => 'serial',
|
17
|
'unsigned' => TRUE,
|
18
|
'not null' => TRUE,
|
19
|
'description' => "The block's {block}.bid.",
|
20
|
),
|
21
|
'info' => array(
|
22
|
'type' => 'varchar',
|
23
|
'length' => 128,
|
24
|
'not null' => TRUE,
|
25
|
'default' => '',
|
26
|
'description' => 'Block description.',
|
27
|
),
|
28
|
'widget_id' => array(
|
29
|
'type' => 'varchar',
|
30
|
'length' => 128,
|
31
|
'not null' => TRUE,
|
32
|
'default' => '',
|
33
|
'description' => 'Widget ID.',
|
34
|
),
|
35
|
'data' => array(
|
36
|
'type' => 'blob',
|
37
|
'size' => 'big',
|
38
|
'not null' => TRUE,
|
39
|
'serialize' => TRUE,
|
40
|
'description' => 'Serialized data containing the timeline properties.',
|
41
|
),
|
42
|
),
|
43
|
'unique keys' => array(
|
44
|
'info' => array('info'),
|
45
|
'widget_id' => array('widget_id'),
|
46
|
),
|
47
|
'primary key' => array('bid'),
|
48
|
);
|
49
|
|
50
|
return $schema;
|
51
|
}
|
52
|
|
53
|
/**
|
54
|
* Implements hook_uninstall().
|
55
|
*/
|
56
|
function twitter_block_uninstall() {
|
57
|
// Remove blocks
|
58
|
db_delete('block')
|
59
|
->condition('module', 'twitter_block')
|
60
|
->execute();
|
61
|
db_delete('block_role')
|
62
|
->condition('module', 'twitter_block')
|
63
|
->execute();
|
64
|
|
65
|
// Clear the site cache
|
66
|
cache_clear_all();
|
67
|
}
|
68
|
|
69
|
/**
|
70
|
* Remove any old Twitter Block blocks and install the new Twitter Block schema.
|
71
|
*/
|
72
|
function twitter_block_update_7200() {
|
73
|
// Remove old Twitter Block schema
|
74
|
drupal_uninstall_schema('twitter_block');
|
75
|
|
76
|
// Remove any old Twitter Block blocks
|
77
|
db_delete('block')
|
78
|
->condition('module', 'twitter_block')
|
79
|
->execute();
|
80
|
db_delete('block_role')
|
81
|
->condition('module', 'twitter_block')
|
82
|
->execute();
|
83
|
|
84
|
// Clear the site cache
|
85
|
cache_clear_all();
|
86
|
|
87
|
// Install the new Twitter Block schema
|
88
|
drupal_install_schema('twitter_block');
|
89
|
|
90
|
return t('Removed any old Twitter Block blocks and installed the new Twitter Block schema.');
|
91
|
}
|