annotate html/ad_html.install @ 5:cd53a6ba3f97
 ad 
maj premiere release officielle 2 module advertisement
 | author | sly | 
 | date | Mon, 27 Apr 2009 10:27:57 +0000 | 
 | parents | d8a3998dac8e | 
 | children |  | 
 | rev | line source | 
  
| pierre@0 | 1 <?php | 
| pierre@0 | 2 // $Id: ad_html.install,v 1.1.2.1.2.4 2009/02/16 17:06:49 jeremy Exp $ | 
| pierre@0 | 3 | 
| pierre@0 | 4 /** | 
| pierre@0 | 5  * @file | 
| pierre@0 | 6  * Ad_html 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_html_schema() { | 
| pierre@0 | 16   $schema['ad_html'] = array( | 
| pierre@0 | 17     'description' => 'The ad_html table stores HTML code of html 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       'html' => array( | 
| pierre@0 | 26         'type' => 'text', | 
| pierre@0 | 27         'not null' => FALSE, | 
| pierre@0 | 28       ), | 
| pierre@0 | 29     ), | 
| pierre@0 | 30     'primary key' => array('aid'), | 
| pierre@0 | 31   ); | 
| pierre@0 | 32   return $schema; | 
| pierre@0 | 33 } | 
| pierre@0 | 34 | 
| pierre@0 | 35 /** | 
| pierre@0 | 36  * ad_html module installation. | 
| pierre@0 | 37  */ | 
| pierre@0 | 38 function ad_html_install() { | 
| pierre@0 | 39   drupal_install_schema('ad_html'); | 
| pierre@0 | 40 } | 
| pierre@0 | 41 | 
| pierre@0 | 42 /** | 
| pierre@0 | 43  * Allow complete uninstallation of the ad_html module. | 
| pierre@0 | 44  */ | 
| pierre@0 | 45 function ad_html_uninstall() { | 
| pierre@0 | 46   // Delete all ad_html content. | 
| pierre@0 | 47   $result = db_query("SELECT aid FROM {ad_html}"); | 
| pierre@0 | 48   while ($aid = db_result($result)) { | 
| pierre@0 | 49     node_delete($aid); | 
| pierre@0 | 50   } | 
| pierre@0 | 51 | 
| pierre@0 | 52   // Remove tables. | 
| pierre@0 | 53   drupal_uninstall_schema('ad_html'); | 
| pierre@0 | 54 } |