1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
<?php
// $Id$
function video_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {video} (
vid int(10) unsigned NOT NULL default '0',
nid int(10) unsigned NOT NULL default '0',
vidfile text NOT NULL default '',
videox smallint(4) unsigned NOT NULL default '0',
videoy smallint(4) unsigned NOT NULL default '0',
size bigint(13) unsigned default NULL,
download_counter int(10) unsigned NOT NULL default '0',
play_counter int(10) unsigned NOT NULL default '0',
video_bitrate int(10) unsigned default NULL,
audio_bitrate int(10) unsigned default NULL,
audio_sampling_rate int(10) unsigned default NULL,
audio_channels enum('','5.1','stereo','mono') default NULL,
playtime_seconds int(10) unsigned default NULL,
download_folder varchar(255) NULL default NULL,
disable_multidownload tinyint(1) unsigned NOT NULL default '0',
use_play_folder tinyint(1) unsigned NOT NULL default '0',
custom_field_1 varchar(255) NULL default NULL,
custom_field_2 varchar(255) NULL default NULL,
custom_field_3 varchar(255) NULL default NULL,
custom_field_4 varchar(255) NULL default NULL,
custom_field_5 text NULL default NULL,
custom_field_6 text NULL default NULL,
serialized_data text NULL default NULL,
PRIMARY KEY (vid)
) TYPE=MyISAM COMMENT='size is in bytes' /*!40100 DEFAULT CHARACTER SET utf8 */;");
break;
case 'pgsql':
db_query("CREATE TABLE {video} (
vid integer NOT NULL default '0',
nid integer NOT NULL default '0',
vidfile text NOT NULL default '',
videox smallint NOT NULL default '0',
videoy smallint NOT NULL default '0',
size bigint default NULL,
download_counter integer NOT NULL default '0',
play_counter integer NOT NULL default '0',
video_bitrate integer default NULL,
audio_bitrate integer default NULL,
audio_sampling_rate integer default NULL,
audio_channels varchar(10) default NULL,
playtime_seconds integer default NULL,
download_folder varchar(255) NULL default NULL,
disable_multidownload smallint NOT NULL default '0',
use_play_folder smallint NOT NULL default '0',
custom_field_1 varchar(255) NULL default NULL,
custom_field_2 varchar(255) NULL default NULL,
custom_field_3 varchar(255) NULL default NULL,
custom_field_4 varchar(255) NULL default NULL,
custom_field_5 text NULL default NULL,
custom_field_6 text NULL default NULL,
serialized_data text NULL default NULL,
PRIMARY KEY (vid)
);");
}
}
/**
* Add audio details
*
* @return array
*/
function video_update_1() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {video} CHANGE videox videox smallint(4) NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE {video} CHANGE videoy videoy smallint(4) NOT NULL default '0'");
$ret[] = update_sql('ALTER TABLE {video} CHANGE size size bigint(13) default NULL');
$ret[] = update_sql('ALTER TABLE {video} ADD video_bitrate int(11) default NULL');
$ret[] = update_sql('ALTER TABLE {video} ADD audio_bitrate int(11) default NULL');
$ret[] = update_sql('ALTER TABLE {video} ADD audio_sampling_rate int(11) default NULL');
$ret[] = update_sql("ALTER TABLE {video} ADD audio_channels enum('','stereo','mono') default NULL");
$ret[] = update_sql('ALTER TABLE {video} ADD playtime_seconds int(11) default NULL');
}
return $ret;
}
/**
* Rename counter, add custom fields, for video.module version 1.9
*
* @return array
*/
function video_update_2() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {video} CHANGE clicks download_counter int(10) unsigned NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE {video} ADD play_counter int(10) unsigned NOT NULL default '0' AFTER download_counter");
$ret[] = update_sql("ALTER TABLE {video} CHANGE audio_channels audio_channels enum('','5.1','stereo','mono') default NULL");
$ret[] = update_sql('ALTER TABLE {video} ADD download_folder varchar(255) NULL default NULL');
$ret[] = update_sql("ALTER TABLE {video} ADD disable_multidownload tinyint(1) NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE {video} ADD use_play_folder tinyint(1) NOT NULL default '0'");
$ret[] = update_sql('ALTER TABLE {video} ADD custom_field_1 varchar(255) NULL default NULL');
$ret[] = update_sql('ALTER TABLE {video} ADD custom_field_2 varchar(255) NULL default NULL');
$ret[] = update_sql('ALTER TABLE {video} ADD custom_field_3 varchar(255) NULL default NULL');
$ret[] = update_sql('ALTER TABLE {video} ADD custom_field_4 varchar(255) NULL default NULL');
$ret[] = update_sql('ALTER TABLE {video} ADD custom_field_5 text NULL default NULL');
$ret[] = update_sql('ALTER TABLE {video} ADD custom_field_6 text NULL default NULL');
}
return $ret;
}
/**
* Add unsigned to all int fields
*
* @return array
*/
function video_update_3() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {video} CHANGE videox videox smallint(4) unsigned NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE {video} CHANGE videoy videoy smallint(4) unsigned NOT NULL default '0'");
$ret[] = update_sql('ALTER TABLE {video} CHANGE size size bigint(13) unsigned default NULL');
$ret[] = update_sql('ALTER TABLE {video} CHANGE video_bitrate video_bitrate int(11) unsigned default NULL');
$ret[] = update_sql('ALTER TABLE {video} CHANGE audio_bitrate audio_bitrate int(11) unsigned default NULL');
$ret[] = update_sql('ALTER TABLE {video} CHANGE audio_sampling_rate audio_sampling_rate int(11) unsigned default NULL');
$ret[] = update_sql('ALTER TABLE {video} CHANGE playtime_seconds playtime_seconds int(11) unsigned default NULL');
$ret[] = update_sql("ALTER TABLE {video} CHANGE disable_multidownload disable_multidownload tinyint(1) unsigned NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE {video} CHANGE use_play_folder use_play_folder tinyint(1) unsigned NOT NULL default '0'");
}
return $ret;
}
/**
* Start of Drupal 4.7 support in video.module issue #40005, version 1.25
* updated revisions, db schema, forms api, form validation, permissions, added .swf and image support
*
* @return array
*/
function video_update_4() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {video} ADD vid int(10) unsigned NOT NULL default '0' FIRST");
$ret[] = update_sql('UPDATE {video} SET vid = nid');
$ret[] = update_sql('ALTER TABLE {video} CHANGE video_bitrate video_bitrate int(10) unsigned default NULL');
$ret[] = update_sql('ALTER TABLE {video} CHANGE audio_bitrate audio_bitrate int(10) unsigned default NULL');
$ret[] = update_sql('ALTER TABLE {video} CHANGE audio_sampling_rate audio_sampling_rate int(10) unsigned default NULL');
$ret[] = update_sql('ALTER TABLE {video} CHANGE playtime_seconds playtime_seconds int(10) unsigned default NULL');
$ret[] = update_sql('ALTER TABLE {video} ADD serialized_data text NULL default NULL');
$ret[] = update_sql('ALTER TABLE {video} DROP PRIMARY KEY, ADD PRIMARY KEY ( `vid` )');
}
return $ret;
}
|