| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: image_fupload.install,v 1.9 2009/03/21 19:10:14 grandcat Exp $ 3 4 /** 5 * Implementation of hook_install(). 6 */ 7 function image_fupload_install() { 8 // install a default preview preset for image module so that it works when it is activated 9 // also preventing 403 errors) 10 $image_node_types = variable_get('image_node_types', array()); 11 if (empty($image_node_types['image'])) { 12 $image_node_types['image'] = array( 13 'title' => 'Image', 14 'fieldname' => 'images', 15 'image_selection' => 'preview', // best choice I think; can be changed in admin menu 16 'imagecache_preset' => '', 17 ); 18 variable_set('image_node_types', $image_node_types); 19 } 20 21 // create table for temporary images for image preview list 22 drupal_install_schema('image_fupload'); 23 } 24 25 /** 26 * Implementation of hook_uninstall(). 27 */ 28 function image_fupload_uninstall() { 29 // remove all used variables 30 $variables = array( 31 'fupload_title_replacements', 32 'fupload_previewlist_img_attributes', 33 'fupload_previewlist_field_settings', 34 'image_node_types', 35 ); 36 for ($i = 0; $i < count($variables); $i++) { 37 variable_del($variables[$i]); 38 } 39 40 // drop our image preview table 41 drupal_uninstall_schema('image_fupload'); 42 } 43 44 /** 45 * Implementation of hook_requirements(). 46 */ 47 function image_fupload_requirements($phase) { 48 $requirements = array(); 49 50 if ($phase == 'runtime') { 51 // Make sure that swfUpload Files which aren't bundled with this module, are located in swfupload directory 52 $path = drupal_get_path('module', 'image_fupload') .'/swfupload/'; 53 if (!file_exists($path .'swfupload.js') || !file_exists($path .'swfupload.queue.js') || !file_exists($path .'swfupload.swf')) { 54 // One or more needed files are missing; give an error 55 $requirements['image_fupload'] = array( 56 'title' => t('Image FUpload'), 57 'value' => t('Missing or wrong files in subdirectory "swfupload"'), 58 'description' => t('Some needed files which are not bundled with this module, are missing or out-of-date! This can be either "swfupload.swf", "swfupload.js" or "swfupload.queue.js" which should be located in "%path". These files can be downloaded from !page. <em>Note:</em> Version 2.2.0 or higher is needed.', array('%path' => $path, '!page' => l(t('SWFUploads project page'), 'http://code.google.com/p/swfupload/'))), 59 'severity' => REQUIREMENT_ERROR, 60 ); 61 } 62 } 63 64 return $requirements; 65 } 66 67 /** 68 * Implementation of hook_schemea 69 */ 70 function image_fupload_schema() { 71 // Currently, schema 1 is the only schema we have. As we make updates, 72 // we might either create a new schema 2 or make adjustments here. 73 return image_fupload_schema_1(); 74 } 75 76 /** 77 * Image FUpload's initial schema; separated for the purposes of updates. 78 */ 79 function image_fupload_schema_1() { 80 $schema['fupload_previewlist'] = array( 81 'description' => t('Caches images for image preview list.'), 82 'fields' => array( 83 'fieldname' => array( 84 'type' => 'varchar', 85 'length' => '32', 86 'default' => '', 87 'not null' => TRUE, 88 'description' => t('Stores name of our image field depending on used node type.'), 89 'no export' => TRUE, 90 ), 91 'uid' => array( 92 'type' => 'int', 93 'length' => '10', 94 'default' => 0, 95 'not null' => TRUE, 96 'description' => t('Stores user id.'), 97 'no export' => TRUE, 98 ), 99 'nid' => array( 100 'type' => 'int', 101 'length' => '10', 102 'default' => 0, 103 'not null' => TRUE, 104 'description' => t('Stores node id.'), 105 'no export' => TRUE, 106 ), 107 'fid' => array( 108 'type' => 'int', 109 'length' => '11', 110 'default' => 0, 111 'not null' => FALSE, 112 'description' => t('Stores file id of uploaded image.'), 113 'no export' => TRUE, 114 ), 115 'created' => array( 116 'type' => 'int', 117 'length' => '11', 118 'default' => 0, 119 'not null' => TRUE, 120 'description' => t('Stores creation time to do some clean up by cron.'), 121 'no export' => TRUE, 122 ), 123 ), 124 'indexes' => array('fieldname' => array('fieldname'), 'uid' => array('uid')), 125 'primary key' => array('fid'), 126 ); 127 128 return $schema; 129 } 130 131 132 /** 133 * Implementation of hook_update_N() 134 */ 135 function image_fupload_update_6100() { 136 $ret = array(); 137 138 // activate image_fupload_image by default 139 /* module_enable(array('image_fupload_image')); 140 * why? 141 */ 142 143 return $ret; 144 } 145 146 function image_fupload_update_6110() { 147 $ret = array(); 148 149 // Create default profile if nothing exists (preventing 403 errors) 150 $image_node_types = variable_get('image_node_types', array()); 151 if (empty($image_node_types['image'])) { 152 $image_node_types['image'] = array( 153 'title' => 'Image', 154 'fieldname' => 'images', 155 'image_selection' => 'preview', // best choice I think; can be changed in admin menu 156 'imagecache_preset' => '', 157 ); 158 variable_set('image_node_types', $image_node_types); 159 } 160 161 return $ret; 162 } 163 164 function image_fupload_update_6300() { 165 $ret = array(); 166 167 // create our image preview list table 168 $schema = image_fupload_schema_1(); 169 _drupal_initialize_schema('image_fupload', $schema); 170 171 foreach ($schema as $name => $table) { 172 db_create_table($ret, $name, $table); 173 } 174 175 return $ret; 176 } 177 178 /** 179 * Update from 3.0 alpha 1 to alpha 2 180 */ 181 function image_fupload_update_6301() { 182 $ret = array(); 183 184 // it's not really an update, but we have to force the user to run update.php 185 // because some theme related things changed 186 187 return $ret; 188 } 189 190 /** 191 * Update from 3.0 alpha 3 to alpha 4 192 */ 193 function image_fupload_update_6304() { 194 $ret = array(); 195 196 // it's not really an update, but we have to force the user to run update.php 197 // because some theme related things changed 198 199 return $ret; 200 }
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 |