Mercurial > defr > drupal > ad
annotate image/ad_image.install @ 0:d8a3998dac8e ad
ajout module ad
| author | pierre | 
|---|---|
| date | Fri, 20 Feb 2009 14:04:09 +0000 | 
| parents | |
| children | 948362c2a207 | 
| rev | line source | 
|---|---|
| pierre@0 | 1 <?php | 
| pierre@0 | 2 // $Id: ad_image.install,v 1.2.2.2.2.6.2.4 2009/02/16 17:06:49 jeremy Exp $ | 
| pierre@0 | 3 | 
| pierre@0 | 4 /** | 
| pierre@0 | 5 * @file | 
| pierre@0 | 6 * Ad_image module database schema. | 
| pierre@0 | 7 * | 
| pierre@0 | 8 * Copyright (c) 2005-2009. | 
| pierre@0 | 9 * Jeremy Andrews <jeremy@tag1consulting.com>. | 
| pierre@0 | 10 */ | 
| pierre@0 | 11 | 
| pierre@0 | 12 /** | 
| pierre@0 | 13 * Implementation of hook_schema(). | 
| pierre@0 | 14 */ | 
| pierre@0 | 15 function ad_image_schema() { | 
| pierre@0 | 16 $schema['ad_image'] = array( | 
| pierre@0 | 17 'description' => 'The ad_image table stores image information such as file ID, title, width, height of corresponding image ads.', | 
| pierre@0 | 18 'fields' => array( | 
| pierre@0 | 19 'aid' => array( | 
| pierre@0 | 20 'type' => 'int', | 
| pierre@0 | 21 'unsigned' => TRUE, | 
| pierre@0 | 22 'not null' => TRUE, | 
| pierre@0 | 23 'default' => 0, | 
| pierre@0 | 24 ), | 
| pierre@0 | 25 'fid' => array( | 
| pierre@0 | 26 'type' => 'int', | 
| pierre@0 | 27 'unsigned' => TRUE, | 
| pierre@0 | 28 'not null' => TRUE, | 
| pierre@0 | 29 'default' => 0, | 
| pierre@0 | 30 ), | 
| pierre@0 | 31 'url' => array( | 
| pierre@0 | 32 'type' => 'varchar', | 
| pierre@0 | 33 'length' => '255', | 
| pierre@0 | 34 'not null' => TRUE, | 
| pierre@0 | 35 'default' => '', | 
| pierre@0 | 36 ), | 
| pierre@0 | 37 'tooltip' => array( | 
| pierre@0 | 38 'type' => 'varchar', | 
| pierre@0 | 39 'length' => '255', | 
| pierre@0 | 40 'not null' => TRUE, | 
| pierre@0 | 41 'default' => '', | 
| pierre@0 | 42 ), | 
| pierre@0 | 43 'width' => array( | 
| pierre@0 | 44 'type' => 'int', | 
| pierre@0 | 45 'unsigned' => TRUE, | 
| pierre@0 | 46 'not null' => TRUE, | 
| pierre@0 | 47 'default' => 0, | 
| pierre@0 | 48 ), | 
| pierre@0 | 49 'height' => array( | 
| pierre@0 | 50 'type' => 'int', | 
| pierre@0 | 51 'unsigned' => TRUE, | 
| pierre@0 | 52 'not null' => TRUE, | 
| pierre@0 | 53 'default' => 0, | 
| pierre@0 | 54 ), | 
| pierre@0 | 55 ), | 
| pierre@0 | 56 'unique keys' => array( | 
| pierre@0 | 57 'aid' => array('aid') | 
| pierre@0 | 58 ), | 
| pierre@0 | 59 ); | 
| pierre@0 | 60 $schema['ad_image_format'] = array( | 
| pierre@0 | 61 'description' => 'The ad_image_format table stores dimensions for image ads.', | 
| pierre@0 | 62 'fields' => array( | 
| pierre@0 | 63 'gid' => array( | 
| pierre@0 | 64 'type' => 'int', | 
| pierre@0 | 65 'unsigned' => TRUE, | 
| pierre@0 | 66 'not null' => TRUE, | 
| pierre@0 | 67 ), | 
| pierre@0 | 68 'min_width' => array( | 
| pierre@0 | 69 'type' => 'int', | 
| pierre@0 | 70 'unsigned' => TRUE, | 
| pierre@0 | 71 'not null' => TRUE, | 
| pierre@0 | 72 'default' => 0, | 
| pierre@0 | 73 ), | 
| pierre@0 | 74 'max_width' => array( | 
| pierre@0 | 75 'type' => 'int', | 
| pierre@0 | 76 'unsigned' => TRUE, | 
| pierre@0 | 77 'not null' => TRUE, | 
| pierre@0 | 78 'default' => 0, | 
| pierre@0 | 79 ), | 
| pierre@0 | 80 'min_height' => array( | 
| pierre@0 | 81 'type' => 'int', | 
| pierre@0 | 82 'unsigned' => TRUE, | 
| pierre@0 | 83 'not null' => TRUE, | 
| pierre@0 | 84 'default' => 0, | 
| pierre@0 | 85 ), | 
| pierre@0 | 86 'max_height' => array( | 
| pierre@0 | 87 'type' => 'int', | 
| pierre@0 | 88 'unsigned' => TRUE, | 
| pierre@0 | 89 'not null' => TRUE, | 
| pierre@0 | 90 'default' => 0, | 
| pierre@0 | 91 ), | 
| pierre@0 | 92 ), | 
| pierre@0 | 93 'primary key' => array('gid'), | 
| pierre@0 | 94 ); | 
| pierre@0 | 95 | 
| pierre@0 | 96 return $schema; | 
| pierre@0 | 97 } | 
| pierre@0 | 98 | 
| pierre@0 | 99 | 
| pierre@0 | 100 /** | 
| pierre@0 | 101 * ad_image module installation. | 
| pierre@0 | 102 */ | 
| pierre@0 | 103 function ad_image_install() { | 
| pierre@0 | 104 drupal_install_schema('ad_image'); | 
| pierre@0 | 105 } | 
| pierre@0 | 106 | 
| pierre@0 | 107 /** | 
| pierre@0 | 108 * Allow complete uninstallation of the ad_image module. | 
| pierre@0 | 109 */ | 
| pierre@0 | 110 function ad_image_uninstall() { | 
| pierre@0 | 111 // Delete all ad_image content. | 
| pierre@0 | 112 $result = db_query("SELECT aid FROM {ad_image}"); | 
| pierre@0 | 113 while ($aid = db_result($result)) { | 
| pierre@0 | 114 node_delete($aid); | 
| pierre@0 | 115 } | 
| pierre@0 | 116 | 
| pierre@0 | 117 // Remove tables. | 
| pierre@0 | 118 drupal_uninstall_schema('ad_image'); | 
| pierre@0 | 119 } | 
