| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @file 5 * Provides installation functions for video.module. 6 * 7 * @author Heshan Wanigasooriya <heshan at heidisoft dot com> 8 * <heshanmw at gmail dot com> 9 * @todo 10 */ 11 12 /** 13 * Implementation of hook_schema(). 14 */ 15 function video_schema() { 16 $schema['video_files'] = array( 17 'description' => t('Store video transcoding queue'), 18 'fields' => array( 19 'vid' => array( 20 'description' => t('Video id'), 21 'type' => 'serial', 22 'unsigned' => TRUE, 23 'not null' => TRUE, 24 ), 25 'fid' => array( 26 'description' => t('Original file id'), 27 'type' => 'int', 28 'unsigned' => TRUE, 29 'not null' => TRUE, 30 'default' => 0, 31 ), 32 'nid' => array( 33 'description' => t('Node id'), 34 'type' => 'int', 35 'unsigned' => TRUE, 36 'not null' => TRUE, 37 'default' => 0, 38 ), 39 'status' => array( 40 'description' => t('Status of the transcoding'), 41 'type' => 'int', 42 'unsigned' => TRUE, 43 'not null' => TRUE, 44 'default' => 0, 45 ), 46 'dimensions' => array( 47 'type' => 'varchar', 48 'length' => '255', 49 'default' => '', 50 'description' => t('The dimensions of the video.'), 51 ), 52 'started' => array( 53 'description' => t('Started transcodings'), 54 'type' => 'int', 55 'not null' => TRUE, 56 'default' => 0, 57 ), 58 'completed' => array( 59 'description' => t('Transcoding completed'), 60 'type' => 'int', 61 'not null' => TRUE, 62 'default' => 0, 63 ), 64 'data' => array( 65 'type' => 'text', 66 'not null' => FALSE, 67 'size' => 'big', 68 'description' => 'A serialized array of converted files. Use of this field is discouraged and it will likely disappear in a future version of Drupal.', 69 ), 70 ), 71 'indexes' => array( 72 'status' => array('status'), 73 'file' => array('fid'), 74 ), 75 'primary key' => array('vid'), 76 ); 77 return $schema; 78 } 79 80 /** 81 * Implementation of hook_install(). 82 */ 83 function video_install() { 84 drupal_install_schema('video'); 85 } 86 87 /** 88 * Implementation of hook_uninstall(). 89 */ 90 function video_uninstall() { 91 drupal_uninstall_schema('video'); 92 93 // Delete all variables that begin with the namespaced "video_*" 94 $result = db_query('SELECT name FROM {variable} WHERE name LIKE "video_%%"'); 95 while ($var = db_fetch_array($result)) { 96 variable_del($var['name']); 97 } 98 99 variable_del('vid_filesystem'); 100 variable_del('vid_convertor'); 101 variable_del('vid_metadata'); 102 variable_del('vid_preset'); 103 } 104 105 /** 106 * Implementation of hook_requirements(). 107 */ 108 function video_requirements($phase) { 109 $t = get_t(); 110 $requirements = array(); 111 112 $fs = variable_get('vid_filesystem', 'drupal'); 113 $downloads = variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC); 114 115 if ($downloads == FILE_DOWNLOADS_PRIVATE && $fs == 'drupal') { 116 $requirements['video_filesystem'] = array( 117 'title' => $t('Video module settings'), 118 'description' => $t('Storing videos in the Drupal file system is not supported when using <a href="@filesystem">private downloads</a>.', array('@filesystem' => url('admin/settings/file-system'))), 119 'value' => l($t('Change setting'), 'admin/settings/video/filesystem'), 120 'severity' => REQUIREMENT_ERROR, 121 ); 122 } 123 124 return $requirements; 125 } 126 127 /** 128 * Update 6405 129 * dropping video_rendering table and creating video_files 130 * @return <type> 131 */ 132 function video_update_6405() { 133 $ret = array(); 134 135 if (db_table_exists('video_rendering')) db_drop_table($ret, 'video_rendering'); 136 if (db_table_exists('video_files')) db_drop_table($ret, 'video_files'); 137 138 $table = array( 139 'description' => t('Store video transcoding queue'), 140 'fields' => array( 141 'vid' => array( 142 'description' => t('Video id'), 143 'type' => 'serial', 144 'unsigned' => TRUE, 145 'not null' => TRUE, 146 ), 147 'fid' => array( 148 'description' => t('Original file id'), 149 'type' => 'int', 150 'unsigned' => TRUE, 151 'not null' => TRUE, 152 'default' => 0, 153 ), 154 'nid' => array( 155 'description' => t('Node id'), 156 'type' => 'int', 157 'unsigned' => TRUE, 158 'not null' => TRUE, 159 'default' => 0, 160 ), 161 'filename' => array( 162 'type' => 'varchar', 163 'length' => '255', 164 'default' => '', 165 'description' => t('The filename of the video.'), 166 ), 167 'filepath' => array( 168 'type' => 'varchar', 169 'length' => '255', 170 'default' => '', 171 'description' => t('The filepath of the video.'), 172 ), 173 'filemime' => array( 174 'type' => 'varchar', 175 'length' => '255', 176 'default' => '', 177 'description' => t('The filemime of the video.'), 178 ), 179 'filesize' => array( 180 'description' => t('Filesize of the video.'), 181 'type' => 'int', 182 'unsigned' => TRUE, 183 'not null' => TRUE, 184 'default' => 0, 185 ), 186 'dimensions' => array( 187 'type' => 'varchar', 188 'length' => '255', 189 'default' => '', 190 'description' => t('The dimensions of the video.'), 191 ), 192 'status' => array( 193 'description' => t('Status of the transcoding'), 194 'type' => 'int', 195 'unsigned' => TRUE, 196 'not null' => TRUE, 197 'default' => 0, 198 ), 199 'started' => array( 200 'description' => t('Started transcodings'), 201 'type' => 'int', 202 'not null' => TRUE, 203 'default' => 0, 204 ), 205 'completed' => array( 206 'description' => t('Transcoding completed'), 207 'type' => 'int', 208 'not null' => TRUE, 209 'default' => 0, 210 ), 211 ), 212 'indexes' => array( 213 'status' => array('status'), 214 'file' => array('fid'), 215 ), 216 'primary key' => array('vid'), 217 ); 218 219 db_create_table($ret, 'video_files', $table); 220 221 return $ret; 222 } 223 224 /** 225 * Update 6406 226 * @return <type> 227 */ 228 function video_update_6406() { 229 drupal_set_message('The system has reset your thumbnail and ffmpeg command settings to their original state. If you made adjustments to these commands, you will have to reset them up.'); 230 //lets reset our ffmpeg system command variables. 231 variable_set('video_ffmpeg_thumbnailer_options', '-i !videofile -an -y -f mjpeg -ss !seek -vframes 1 !thumbfile'); 232 variable_set('video_ffmpeg_helper_auto_cvr_options', '-y -i !videofile -f flv -ar 22050 -ab !audiobitrate -s !size -b !videobitrate -qscale 1 !convertfile'); 233 return array(); 234 } 235 236 /** 237 * Update 6407 238 */ 239 function video_update_6407() { 240 $ret = array(); 241 // drop un wanted fields in video files 242 db_drop_field($ret, 'video_files', 'filesize'); 243 db_drop_field($ret, 'video_files', 'filename'); 244 db_drop_field($ret, 'video_files', 'filepath'); 245 db_drop_field($ret, 'video_files', 'filemime'); 246 switch ($GLOBALS['db_type']) { 247 case 'mysql': 248 case 'mysqli': 249 db_add_column($ret, 'video_files', 'data', 'longtext', array('null' => TRUE)); 250 break; 251 case 'pgsql': 252 db_add_column($ret, 'video_files', 'data', 'text', array('null' => TRUE)); 253 break; 254 } 255 return $ret; 256 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |