/[drupal]/contributions/sandbox/alex_b/feedapi_fav/feedapi_fav.install
ViewVC logotype

Contents of /contributions/sandbox/alex_b/feedapi_fav/feedapi_fav.install

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


Revision 1.4 - (show annotations) (download) (as text)
Sun Nov 11 22:05:10 2007 UTC (2 years ago) by alexb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
File MIME type: text/x-php
 line
1 <?php
2 // $Id: $
3
4 /**
5 * Install hook.
6 */
7 function feedapi_fav_install() {
8 switch ($GLOBALS['db_type']) {
9 case 'mysqli':
10 case 'mysql':
11 db_query("CREATE TABLE if not exists {feedapi_fav} (
12 nid int(10) unsigned NOT NULL default '0',
13 filename varchar(255) NOT NULL default '',
14 PRIMARY KEY(nid))
15 ");
16 break;
17 case 'pgsql':
18 db_query("CREATE TABLE {feedapi_fav} (
19 nid SERIAL,
20 filename varchar(255) NOT NULL default '',
21 PRIMARY KEY(nid))
22 ");
23 break;
24 }
25 if(!mkdir(file_directory_path() .'/feedapi_fav', 0777)) {
26 drupal_set_message(t('Error creating feedapi_fav subdirectory in files directory.
27 Create feedapi_fav subdirectory in your files directory by hand. If it already exists,
28 make sure that Drupal has write access to it.'), 'error');
29 }
30 }
31
32 /**
33 * Uninstall hook.
34 */
35 function feedapi_fav_uninstall() {
36 switch ($GLOBALS['db_type']) {
37 case 'mysqli':
38 case 'mysql':
39 case 'pgsql':
40 db_query("DROP TABLE {feedapi_fav}");
41 break;
42 }
43 if (!rmdir(file_directory_path() .'/feedapi_fav')) {
44 drupal_set_message(t('Could not remove feedapi_fav subdirectory.'), 'error');
45 }
46 }

  ViewVC Help
Powered by ViewVC 1.1.2