/[drupal]/contributions/modules/feedburner/feedburner.install
ViewVC logotype

Contents of /contributions/modules/feedburner/feedburner.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Fri Jul 27 05:10:49 2007 UTC (2 years, 3 months ago) by davereid
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5, DRUPAL-6--1
Changes since 1.2: +50 -3 lines
File MIME type: text/x-php
no message
1 <?php
2 // $Id$
3
4 /**
5 * Implementation of hook_install().
6 */
7 function feedburner_install() {
8 switch ($GLOBALS['db_type']) {
9 case 'mysql':
10 case 'mysqli':
11 db_query("CREATE TABLE IF NOT EXISTS {feedburner_feeds} (
12 fid int unsigned NOT NULL default '0',
13 local_uri varchar(128) NOT NULL default '',
14 fb_uri varchar(100) NOT NULL default '',
15 verified int NOT NULL default '0',
16 details longtext,
17 PRIMARY KEY (fid, uri)
18 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
19 case 'pgsql':
20 break;
21 }
22 }
23
24 /**
25 * Implementation of hook_update_x().
26 *
27 * Adds the FeedBurner table and converts the currently redirecting feeds to
28 * use the table since I only used a variable array in the first few versions.
29 */
30 function feedburner_update_1() {
31 $items = array();
32 $items[] = update_sql("CREATE TABLE IF NOT EXISTS {feedburner_feeds} (
33 fid int unsigned NOT NULL default '0',
34 local_uri varchar(128) NOT NULL default '',
35 fb_uri varchar(100) NOT NULL default '',
36 verified int NOT NULL default '0',
37 details longtext,
38 PRIMARY KEY (fid, uri)
39 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
40 $feeds = variable_get('feedburner_feeds', array());
41 foreach ($feeds as $local_uri => $fb_uri) {
42 $items[] = update_sql("INSERT INTO {feedburner_feeds} (local_uri, fb_uri) VALUES ('". $local_uri ."', '". $fb_uri ."')");
43 }
44 variable_del('feedburner_feeds');
45 return $items;
46 }
47
48 /**
49 * Implementation of hook_uninstall().
50 * Removes tables and variables used by this module.
51 */
52 function feedburner_uninstall() {
53 // Delete all the feedburner variables
54 $variables = db_query("SELECT name FROM variable WHERE name LIKE 'feedburner%'");
55 while ($variable = db_result($variables)) {
56 variable_del($variable);
57 }
58 // Alternative method, but not as kosher
59 //db_query("DELETE FROM {variable} WHERE name LIKE 'feedburner%'");
60 //cache_clear_all('variables', 'cache');
61
62 // Remove feedburner table (can't use IF EXISTS since only latest PostgreSQL supports it
63 db_query("DROP TABLE {feedburner_feeds}");
64 }

  ViewVC Help
Powered by ViewVC 1.1.2