aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Norman <drupal@deekayen.net>2006-04-01 13:41:29 +0000
committerDavid Norman <drupal@deekayen.net>2006-04-01 13:41:29 +0000
commitbcb660107dd2a1963bc65a95082ad756392cad15 (patch)
treec8e02a9a7db0fbc42bed8a6f18f7acb4f30f3b5a
parent1715fbb57c5267d63376c8b21e1a28d67190a096 (diff)
downloadvideo-bcb660107dd2a1963bc65a95082ad756392cad15.tar.gz
video-bcb660107dd2a1963bc65a95082ad756392cad15.tar.bz2
friendly Drupal 4.7 upgrade path
-rw-r--r--video.install129
1 files changed, 129 insertions, 0 deletions
diff --git a/video.install b/video.install
new file mode 100644
index 0000000..98a628d
--- /dev/null
+++ b/video.install
@@ -0,0 +1,129 @@
+<?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 */;");
+ }
+}
+
+/**
+ * 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;
+}