| 1 |
<?php
|
| 2 |
// $Id: bluga.install,v 1.1.4.1 2009/11/01 05:27:51 hanenkamp Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Installation and schema definitions.
|
| 7 |
*/
|
| 8 |
|
| 9 |
function bluga_schema() {
|
| 10 |
$schema['bluga_request'] = array(
|
| 11 |
'description' => 'All the information you ever wanted to store about a Bluga API request.',
|
| 12 |
'fields' => array(
|
| 13 |
'rid' => array(
|
| 14 |
'description' => 'request ID',
|
| 15 |
'type' => 'serial',
|
| 16 |
'unsigned' => TRUE,
|
| 17 |
'not null' => TRUE,
|
| 18 |
),
|
| 19 |
|
| 20 |
'url' => array(
|
| 21 |
'description' => 'The URL to create a thumbnail for.',
|
| 22 |
'type' => 'varchar',
|
| 23 |
'length' => 150,
|
| 24 |
'not null' => TRUE,
|
| 25 |
),
|
| 26 |
'output_type' => array(
|
| 27 |
'description' => 'The type of file to output: jpg or png.',
|
| 28 |
'type' => 'varchar',
|
| 29 |
'length' => 3,
|
| 30 |
'not null' => TRUE,
|
| 31 |
'default' => 'jpg',
|
| 32 |
),
|
| 33 |
'browser_width' => array(
|
| 34 |
'description' => 'Width of the browser to display the URL.',
|
| 35 |
'type' => 'int',
|
| 36 |
'size' => 'small',
|
| 37 |
'unsigned' => TRUE,
|
| 38 |
'not null' => TRUE,
|
| 39 |
'default' => 0,
|
| 40 |
),
|
| 41 |
'browser_height' => array(
|
| 42 |
'description' => 'Height of the browser to display the URL.',
|
| 43 |
'type' => 'int',
|
| 44 |
'size' => 'small',
|
| 45 |
'unsigned' => TRUE,
|
| 46 |
'not null' => TRUE,
|
| 47 |
'default' => 0,
|
| 48 |
),
|
| 49 |
'fullthumb' => array(
|
| 50 |
'description' => 'If true, also creates a fullsize thumb.',
|
| 51 |
'type' => 'int',
|
| 52 |
'size' => 'tiny',
|
| 53 |
'unsigned' => TRUE,
|
| 54 |
'not null' => TRUE,
|
| 55 |
'default' => 0,
|
| 56 |
),
|
| 57 |
'custom_height' => array(
|
| 58 |
'description' => 'Custom thumbnail height.',
|
| 59 |
'type' => 'int',
|
| 60 |
'size' => 'small',
|
| 61 |
'unsigned' => TRUE,
|
| 62 |
'not null' => TRUE,
|
| 63 |
'default' => 0,
|
| 64 |
),
|
| 65 |
'custom_width' => array(
|
| 66 |
'description' => 'Custom thumbnail width.',
|
| 67 |
'type' => 'int',
|
| 68 |
'size' => 'small',
|
| 69 |
'unsigned' => TRUE,
|
| 70 |
'not null' => TRUE,
|
| 71 |
'default' => 0,
|
| 72 |
),
|
| 73 |
'effect' => array(
|
| 74 |
'description' => 'Apply a special effect to the thumbnail.',
|
| 75 |
'type' => 'varchar',
|
| 76 |
'length' => 10,
|
| 77 |
'not null' => TRUE,
|
| 78 |
'default' => '',
|
| 79 |
),
|
| 80 |
'delay' => array(
|
| 81 |
'description' => 'Number of seconds to wait between loading the URL and taking the thumbnail.',
|
| 82 |
'type' => 'int',
|
| 83 |
'size' => 'tiny',
|
| 84 |
'unsigned' => TRUE,
|
| 85 |
'not null' => TRUE,
|
| 86 |
'default' => 3,
|
| 87 |
),
|
| 88 |
|
| 89 |
// These next ones only matter when thumbnail size "excerpt" is set
|
| 90 |
'excerpt_x' => array(
|
| 91 |
'description' => 'Only grab pixels right of this.',
|
| 92 |
'type' => 'int',
|
| 93 |
'size' => 'small',
|
| 94 |
'unsigned' => TRUE,
|
| 95 |
'not null' => TRUE,
|
| 96 |
'default' => 0,
|
| 97 |
),
|
| 98 |
'excerpt_y' => array(
|
| 99 |
'description' => 'Only grab pixels below this.',
|
| 100 |
'type' => 'int',
|
| 101 |
'size' => 'small',
|
| 102 |
'unsigned' => TRUE,
|
| 103 |
'not null' => TRUE,
|
| 104 |
'default' => 0,
|
| 105 |
),
|
| 106 |
'excerpt_width' => array(
|
| 107 |
'description' => 'Only grab this many pixels wide.',
|
| 108 |
'type' => 'int',
|
| 109 |
'size' => 'small',
|
| 110 |
'unsigned' => TRUE,
|
| 111 |
'not null' => TRUE,
|
| 112 |
'default' => 400,
|
| 113 |
),
|
| 114 |
'excerpt_height' => array(
|
| 115 |
'description' => 'Only grab this many pixels tall.',
|
| 116 |
'type' => 'int',
|
| 117 |
'size' => 'small',
|
| 118 |
'unsigned' => TRUE,
|
| 119 |
'not null' => TRUE,
|
| 120 |
'default' => 150,
|
| 121 |
),
|
| 122 |
|
| 123 |
// Stuff Bluga tells us about this request
|
| 124 |
'job_id' => array(
|
| 125 |
'description' => 'Job ID assigned by the Bluga WebThumbs service.',
|
| 126 |
'type' => 'varchar',
|
| 127 |
'length' => 15,
|
| 128 |
'not null' => TRUE,
|
| 129 |
),
|
| 130 |
'estimate' => array(
|
| 131 |
'description' => 'The # of seconds Bluga thinks it will take.',
|
| 132 |
'type' => 'int',
|
| 133 |
'size' => 'small',
|
| 134 |
'unsigned' => TRUE,
|
| 135 |
'not null' => TRUE,
|
| 136 |
'default' => 0,
|
| 137 |
),
|
| 138 |
'submission_time' => array(
|
| 139 |
'description' => 'Submission time returned by Bluga.',
|
| 140 |
'type' => 'varchar',
|
| 141 |
'length' => 20,
|
| 142 |
'not null' => TRUE,
|
| 143 |
'default' => '',
|
| 144 |
),
|
| 145 |
'cost' => array(
|
| 146 |
'description' => 'The number of tokens Bluga charged for this.',
|
| 147 |
'type' => 'int',
|
| 148 |
'size' => 'tiny',
|
| 149 |
'unsigned' => TRUE,
|
| 150 |
'not null' => TRUE,
|
| 151 |
'default' => 1,
|
| 152 |
),
|
| 153 |
|
| 154 |
// What to do when finished
|
| 155 |
'pickup_url' => array(
|
| 156 |
'description' => 'Where to fetch the thumbnail from.',
|
| 157 |
'type' => 'varchar',
|
| 158 |
'length' => 150,
|
| 159 |
'not null' => TRUE,
|
| 160 |
'default' => '',
|
| 161 |
),
|
| 162 |
'completion_time' => array(
|
| 163 |
'description' => 'When Bluga finished it.',
|
| 164 |
'type' => 'varchar',
|
| 165 |
'length' => 20,
|
| 166 |
'not null' => TRUE,
|
| 167 |
'default' => '',
|
| 168 |
),
|
| 169 |
|
| 170 |
// Names of the locally cached files
|
| 171 |
'filename_small' => array(
|
| 172 |
'description' => 'The small thumbnail.',
|
| 173 |
'type' => 'varchar',
|
| 174 |
'length' => 100,
|
| 175 |
'not null' => TRUE,
|
| 176 |
'default' => '',
|
| 177 |
),
|
| 178 |
'filename_medium' => array(
|
| 179 |
'description' => 'The medium thumbnail.',
|
| 180 |
'type' => 'varchar',
|
| 181 |
'length' => 100,
|
| 182 |
'not null' => TRUE,
|
| 183 |
'default' => '',
|
| 184 |
),
|
| 185 |
'filename_medium2' => array(
|
| 186 |
'description' => 'The medium2 thumbnail.',
|
| 187 |
'type' => 'varchar',
|
| 188 |
'length' => 100,
|
| 189 |
'not null' => TRUE,
|
| 190 |
'default' => '',
|
| 191 |
),
|
| 192 |
'filename_large' => array(
|
| 193 |
'description' => 'The large thumbnail.',
|
| 194 |
'type' => 'varchar',
|
| 195 |
'length' => 100,
|
| 196 |
'not null' => TRUE,
|
| 197 |
'default' => '',
|
| 198 |
),
|
| 199 |
'filename_excerpt' => array(
|
| 200 |
'description' => 'The excerpt thumbnail.',
|
| 201 |
'type' => 'varchar',
|
| 202 |
'length' => 100,
|
| 203 |
'not null' => TRUE,
|
| 204 |
'default' => '',
|
| 205 |
),
|
| 206 |
'filename_full' => array(
|
| 207 |
'description' => 'The full "thumbnail."',
|
| 208 |
'type' => 'varchar',
|
| 209 |
'length' => 100,
|
| 210 |
'not null' => TRUE,
|
| 211 |
'default' => '',
|
| 212 |
),
|
| 213 |
'filename_custom' => array(
|
| 214 |
'description' => 'The custom thumbnail.',
|
| 215 |
'type' => 'varchar',
|
| 216 |
'length' => 100,
|
| 217 |
'not null' => TRUE,
|
| 218 |
'default' => '',
|
| 219 |
),
|
| 220 |
'filename_effect' => array(
|
| 221 |
'description' => 'The special effect thumbnail.',
|
| 222 |
'type' => 'varchar',
|
| 223 |
'length' => 100,
|
| 224 |
'not null' => TRUE,
|
| 225 |
'default' => '',
|
| 226 |
),
|
| 227 |
),
|
| 228 |
|
| 229 |
'primary key' => array('rid'),
|
| 230 |
);
|
| 231 |
|
| 232 |
return $schema;
|
| 233 |
}
|
| 234 |
|
| 235 |
function bluga_install() {
|
| 236 |
drupal_install_schema('bluga');
|
| 237 |
}
|
| 238 |
|
| 239 |
// We don't drop the tables or remove cached files on uninstall
|