| [ 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_s3.module. 6 */ 7 8 /** 9 * Implementation of hook_schema(). 10 */ 11 function video_s3_schema() { 12 $schema['video_s3'] = array( 13 'description' => t('Store video s3 cdn'), 14 'fields' => array( 15 'vid' => array( 16 'description' => t('Auto Increment id'), 17 'type' => 'serial', 18 'unsigned' => TRUE, 19 'not null' => TRUE, 20 ), 21 'fid' => array( 22 'description' => t('Original file id'), 23 'type' => 'int', 24 'unsigned' => TRUE, 25 'not null' => TRUE, 26 'default' => 0, 27 ), 28 'nid' => array( 29 'description' => t('Node id'), 30 'type' => 'int', 31 'unsigned' => TRUE, 32 'not null' => TRUE, 33 'default' => 0, 34 ), 35 'bucket' => array( 36 'type' => 'varchar', 37 'length' => '255', 38 'default' => '', 39 'description' => t('The bucket the video is stored in.'), 40 ), 41 'filename' => array( 42 'type' => 'varchar', 43 'length' => '255', 44 'default' => '', 45 'description' => t('The filename of the video.'), 46 ), 47 'filepath' => array( 48 'type' => 'varchar', 49 'length' => '255', 50 'default' => '', 51 'description' => t('The filepath of the video.'), 52 ), 53 'filemime' => array( 54 'type' => 'varchar', 55 'length' => '255', 56 'default' => '', 57 'description' => t('The filemime of the video.'), 58 ), 59 'filesize' => array( 60 'description' => t('Filesize of the video.'), 61 'type' => 'int', 62 'unsigned' => TRUE, 63 'not null' => TRUE, 64 'default' => 0, 65 ), 66 'status' => array( 67 'description' => t('Status of the cdn transfer'), 68 'type' => 'int', 69 'unsigned' => TRUE, 70 'not null' => TRUE, 71 'default' => 0, 72 ), 73 'completed' => array( 74 'description' => t('Time of successful completion to amazon.'), 75 'type' => 'int', 76 'not null' => TRUE, 77 'default' => 0, 78 ), 79 ), 80 'indexes' => array( 81 'status' => array('status'), 82 'file' => array('fid'), 83 ), 84 'primary key' => array('vid'), 85 ); 86 return $schema; 87 } 88 89 /** 90 * Implementation of hook_install(). 91 */ 92 function video_s3_install() { 93 drupal_install_schema('video_s3'); 94 95 // The video_s3 module cron hook must execute after the video module 96 // in order for ffmpeg converted files to be uploaded to S3 in the same cron run. 97 db_query("UPDATE {system} SET weight = 10 WHERE name = 'video_s3'"); 98 } 99 100 /** 101 * Implementation of hook_uninstall(). 102 */ 103 function video_s3_uninstall() { 104 global $conf; 105 drupal_uninstall_schema('video_s3'); 106 // Delete our variables. 107 foreach (array_keys($conf) as $var) { 108 if (strpos($var, 'amazon_s3') === 0) { 109 variable_del($var); 110 } 111 } 112 } 113 114 /** 115 * Implementation of hook_requirements(). 116 */ 117 function video_s3_requirements($phase) { 118 $t = get_t(); 119 $requirements = array(); 120 121 if (!module_exists('libraries')) { 122 $requirements['video_s3_libraries'] = array( 123 'title' => $t('Video Amazon S3 requirements'), 124 'description' => $t('The <a href="@libraries-url">Libraries API</a> module is required to use the Video Amazon S3 module since version 4.8.', array('@libraries-url' => 'http://drupal.org/project/libraries')), 125 'value' => l($t('Download'), 'http://drupal.org/project/libraries'), 126 'severity' => REQUIREMENT_ERROR, 127 ); 128 } 129 else { 130 $path = libraries_get_path('awssdk'); 131 $file = $path .'/sdk.class.php'; 132 133 if (!is_dir($path)) { 134 $requirements['video_s3_library'] = array( 135 'title' => $t('Video Amazon S3 library'), 136 'description' => $t('The <a href="@aws-library-url">Amazon Web Services SDK</a> must be installed to %libpath to use Amazon S3 to store videos.', array('@aws-library-url' => 'http://aws.amazon.com/sdkforphp/', '%libpath' => $path)), 137 'value' => l($t('Download'), 'http://aws.amazon.com/sdkforphp/'), 138 'severity' => REQUIREMENT_ERROR, 139 ); 140 } 141 elseif (!is_file($file)) { 142 $requirements['video_s3_library'] = array( 143 'title' => $t('Video Amazon S3 library'), 144 'description' => $t('The directory %libpath is found, but the <a href="@aws-library-url">Amazon Web Services SDK</a> does not appear to be installed correctly, as the file %libfile is not found. Check if the library archive has been extracted correctly.', array('@aws-library-url' => 'http://aws.amazon.com/sdkforphp/', '%libpath' => $path, '%libfile' => $file)), 145 'value' => l($t('Download'), 'http://aws.amazon.com/sdkforphp/'), 146 'severity' => REQUIREMENT_ERROR, 147 ); 148 } 149 else { 150 require_once $file; 151 152 $requirements['video_s3_library'] = array( 153 'title' => $t('Video Amazon S3 library'), 154 'value' => check_plain(CFRUNTIME_VERSION), 155 'severity' => REQUIREMENT_OK, 156 ); 157 } 158 } 159 160 return $requirements; 161 } 162 163 function video_s3_update_6000() { 164 $ret = array(); 165 166 $ret[] = update_sql("UPDATE {system} SET weight = 10 WHERE name = 'video_s3'"); 167 168 return $ret; 169 }
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 |