Mercurial > defr > drupal > ad
comparison text/ad_text.install @ 0:d8a3998dac8e ad
ajout module ad
| author | pierre |
|---|---|
| date | Fri, 20 Feb 2009 14:04:09 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:d8a3998dac8e |
|---|---|
| 1 <?php | |
| 2 // $Id: ad_text.install,v 1.2.2.2.2.4.2.4 2009/02/16 17:06:50 jeremy Exp $ | |
| 3 | |
| 4 /** | |
| 5 * @file | |
| 6 * Ad_text module database schema. | |
| 7 * | |
| 8 * Copyright (c) 2005-2009. | |
| 9 * Jeremy Andrews <jeremy@tag1consulting.com>. | |
| 10 */ | |
| 11 | |
| 12 /** | |
| 13 * Implementation of hook_schema(). | |
| 14 */ | |
| 15 function ad_text_schema() { | |
| 16 $schema['ad_text'] = array( | |
| 17 'description' => 'The ad_text table stores sources of text ads.', | |
| 18 'fields' => array( | |
| 19 'aid' => array( | |
| 20 'type' => 'int', | |
| 21 'unsigned' => TRUE, | |
| 22 'not null' => TRUE, | |
| 23 'default' => 0, | |
| 24 ), | |
| 25 'url' => array( | |
| 26 'type' => 'varchar', | |
| 27 'length' => '255', | |
| 28 'not null' => TRUE, | |
| 29 'default' => '', | |
| 30 ), | |
| 31 'adheader' => array( | |
| 32 'type' => 'varchar', | |
| 33 'length' => '255', | |
| 34 'not null' => TRUE, | |
| 35 'default' => '', | |
| 36 ), | |
| 37 'adbody' => array( | |
| 38 'type' => 'text', | |
| 39 'not null' => FALSE, | |
| 40 ), | |
| 41 ), | |
| 42 'primary key' => array('aid'), | |
| 43 ); | |
| 44 | |
| 45 return $schema; | |
| 46 } | |
| 47 | |
| 48 /** | |
| 49 * ad_text module installation. | |
| 50 */ | |
| 51 function ad_text_install() { | |
| 52 drupal_install_schema('ad_text'); | |
| 53 } | |
| 54 | |
| 55 /** | |
| 56 * Allow complete uninstallation of the ad_text module. | |
| 57 */ | |
| 58 function ad_text_uninstall() { | |
| 59 // Delete all ad_text content. | |
| 60 $result = db_query("SELECT aid FROM {ad_text}"); | |
| 61 while ($aid = db_result($result)) { | |
| 62 node_delete($aid); | |
| 63 } | |
| 64 | |
| 65 // Remove tables. | |
| 66 drupal_uninstall_schema('ad_text'); | |
| 67 } |
