Mercurial > defr > drupal > ad
comparison html/ad_html.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_html.install,v 1.1.2.1.2.4 2009/02/16 17:06:49 jeremy Exp $ | |
3 | |
4 /** | |
5 * @file | |
6 * Ad_html 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_html_schema() { | |
16 $schema['ad_html'] = array( | |
17 'description' => 'The ad_html table stores HTML code of html ads.', | |
18 'fields' => array( | |
19 'aid' => array( | |
20 'type' => 'int', | |
21 'unsigned' => TRUE, | |
22 'not null' => TRUE, | |
23 'default' => 0, | |
24 ), | |
25 'html' => array( | |
26 'type' => 'text', | |
27 'not null' => FALSE, | |
28 ), | |
29 ), | |
30 'primary key' => array('aid'), | |
31 ); | |
32 return $schema; | |
33 } | |
34 | |
35 /** | |
36 * ad_html module installation. | |
37 */ | |
38 function ad_html_install() { | |
39 drupal_install_schema('ad_html'); | |
40 } | |
41 | |
42 /** | |
43 * Allow complete uninstallation of the ad_html module. | |
44 */ | |
45 function ad_html_uninstall() { | |
46 // Delete all ad_html content. | |
47 $result = db_query("SELECT aid FROM {ad_html}"); | |
48 while ($aid = db_result($result)) { | |
49 node_delete($aid); | |
50 } | |
51 | |
52 // Remove tables. | |
53 drupal_uninstall_schema('ad_html'); | |
54 } |