From 72f7b7109d1cdf3ec1f5fb022170dedc8c9dc5e1 Mon Sep 17 00:00:00 2001 From: Heshan Date: Fri, 4 Mar 2011 23:20:28 +0530 Subject: Creating presets which can be exported with features, chostools and move subsidary module to modules directory --- video.install | 108 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 41 deletions(-) (limited to 'video.install') diff --git a/video.install b/video.install index 956f6ef..3250513 100644 --- a/video.install +++ b/video.install @@ -2,61 +2,60 @@ /** * @file - * Provides installation functions for video.module. - * - * @author Heshan Wanigasooriya + * Provides installation schema for video.module + * @author Heshan Wanigasooriya * - * @todo */ /** * Implementation of hook_schema(). */ function video_schema() { + // video files $schema['video_files'] = array( - 'description' => 'Store video transcoding queue', + 'description' => 'Store video transcoding queue.', 'fields' => array( 'vid' => array( - 'description' => t('Video id'), + 'description' => t('Video id, the primary identifier'), 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), 'fid' => array( - 'description' => 'Original file id', + 'description' => 'The {file_managed}.fid being referenced in this field.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'nid' => array( - 'description' => 'Node id', + 'description' => 'The {node}.nid being referenced in this field.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'status' => array( - 'description' => 'Status of the transcoding', + 'description' => 'Status of the transcoding, possible values are 1, 5, 10, 20', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'dimensions' => array( + 'description' => 'The dimensions of the output video.', 'type' => 'varchar', 'length' => '255', 'default' => '', - 'description' => 'The dimensions of the video.', ), 'started' => array( - 'description' => t('Started transcodings'), + 'description' => t('Start timestamp of transcodings'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'completed' => array( - 'description' => 'Transcoding completed', + 'description' => 'Transcoding completed timestamp', 'type' => 'int', 'not null' => TRUE, 'default' => 0, @@ -65,7 +64,8 @@ function video_schema() { 'type' => 'text', 'not null' => FALSE, 'size' => 'big', - 'description' => 'A serialized array of converted files. Use of this field is discouraged and it will likely disappear in a future version of Drupal.', + 'description' => 'A serialized array of converted files. + Use of this field is discouraged and it will likely disappear in a future version of Drupal.', ), ), 'indexes' => array( @@ -74,37 +74,45 @@ function video_schema() { ), 'primary key' => array('vid'), ); + // video preset + $schema['video_preset'] = array( + 'description' => 'The preset table.', + 'fields' => array( + 'pid' => array( + 'description' => 'The primary identifier for a video preset.', + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'name' => array( + 'description' => 'The name of this preset.', + 'type' => 'varchar', + 'length' => 64, + 'not null' => TRUE, + 'default' => '', + ), + 'description' => array( + 'description' => 'A brief description of this preset.', + 'type' => 'text', + 'size' => 'medium', + 'translatable' => TRUE, + ), + 'settings' => array( + 'type' => 'text', + 'size' => 'medium', + 'serialize' => TRUE, + 'description' => 'Serialized player settings that do not warrant a dedicated column. + Use of this field is discouraged and it will likely disappear in a future version of Drupal.', + ), + ), + 'unique keys' => array( + 'name' => array('name'), + ), + 'primary key' => array('pid'), + ); return $schema; } -/** - * Implementation of hook_install(). - */ -function video_install() { - // Create the videos directory and ensure it's writable. - $directory = file_default_scheme() . '://videos'; - file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); -} - -/** - * Implementation of hook_uninstall(). - */ -function video_uninstall() { - drupal_uninstall_schema('video'); -// Delete all variables which begin with the namespaced "video_*". -// $video_vars = array(); -// $query = "SELECT name FROM {variable} WHERE name LIKE '%video_%'"; -// $video_vars = db_query($query); -// while ($result = db_fetch_array($video_vars)) { -// if (strpos($result['name'], 'video') === 0) { -// variable_del($result['name']); -// } -// } -// - // Remove the video directory and generated images. - file_unmanaged_delete_recursive(file_default_scheme() . '://videos'); -} - /** * Implements hook_field_schema(). */ @@ -146,4 +154,22 @@ function video_field_schema($field) { ), ), ); +} + +/** + * Implementation of hook_install(). + */ +function video_install() { + // Create the videos directory and ensure it's writable. + $directory = file_default_scheme() . '://videos'; + file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); +} + +/** + * Implementation of hook_uninstall(). + */ +function video_uninstall() { + drupal_uninstall_schema('video'); + // Remove the video directory and generated images. + file_unmanaged_delete_recursive(file_default_scheme() . '://videos'); } \ No newline at end of file -- cgit v1.2.3