* * @todo */ /** * Implementation of hook_schema(). */ function video_schema() { $schema['video_files'] = array( 'description' => 'Store video transcoding queue', 'fields' => array( 'vid' => array( 'description' => t('Video id'), 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), 'fid' => array( 'description' => 'Original file id', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'nid' => array( 'description' => 'Node id', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'status' => array( 'description' => 'Status of the transcoding', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'dimensions' => array( 'type' => 'varchar', 'length' => '255', 'default' => '', 'description' => 'The dimensions of the video.', ), 'started' => array( 'description' => t('Started transcodings'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'completed' => array( 'description' => 'Transcoding completed', 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'data' => array( '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.', ), ), 'indexes' => array( 'status' => array('status'), 'file' => array('fid'), ), 'primary key' => array('vid'), ); 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(). */ function video_field_schema($field) { return array( 'columns' => array( 'fid' => array( 'description' => 'The {file_managed}.fid being referenced in this field.', 'type' => 'int', 'not null' => FALSE, 'unsigned' => TRUE, ), 'thumbanail' => array( 'description' => 'The {file_managed}.fid being referenced for video thumbanil.', 'type' => 'int', 'not null' => FALSE, 'unsigned' => TRUE, ), 'use_default_video_thumb' => array( 'description' => 'Use video thumbanil.', 'type' => 'int', 'not null' => FALSE, 'unsigned' => TRUE, ), 'player_dimensions' => array( 'description' => "Video dimention for the video player.", 'type' => 'varchar', 'length' => 32, 'not null' => FALSE, ) ), 'indexes' => array( 'fid' => array('fid'), ), 'foreign keys' => array( 'fid' => array( 'table' => 'file_managed', 'columns' => array('fid' => 'fid'), ), ), ); }