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

Contents of /contributions/modules/link_checker/link_checker.install

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


Revision 1.6 - (show annotations) (download) (as text)
Thu Sep 25 08:09:43 2008 UTC (14 months ago) by jredding
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +1 -1 lines
File MIME type: text/x-php
problems with the install file when updating to 1
1 <?php
2
3 /**
4 * Implementation of hook_install().
5 */
6 function link_checker_install() {
7 switch ($GLOBALS['db_type']) {
8 case 'mysql':
9 case 'mysqli':
10 $query = db_query("CREATE TABLE IF NOT EXISTS {link_checker} (
11 vid INT(10) UNSIGNED NOT NULL DEFAULT 0,
12 nid INT(10) UNSIGNED NOT NULL DEFAULT 0,
13 delta INT(10) UNSIGNED NOT NULL DEFAULT 0,
14 last_checked DATETIME DEFAULT '2000-01-01 00:00:00',
15 status INT(4) NOT NULL DEFAULT 0,
16 field_name varchar(254) NOT NULL,
17 error_count INT UNSIGNED NOT NULL DEFAULT 0,
18 PRIMARY KEY (`vid`, `nid`, `delta`, `field_name`),
19 INDEX(last_checked),
20 INDEX(status)
21 ) /*!40100 DEFAULT CHARACTER SET utf8 */");
22 if($query1) {
23 $created = TRUE;
24 }
25 break;
26
27 case 'pgsql':
28 $query = db_query("CREATE TABLE {link_checker} (
29 vid INT UNSIGNED NOT NULL DEFAULT 0,
30 nid INT UNSIGNED NOT NULL DEFAULT 0,
31 delta INT UNSIGNED NOT NULL DEFAULT 0,
32 last_checked int DEFAULT 0,
33 status INT NOT NULL DEFAULT 0,
34 field_name varchar(254) NOT NULL,
35 error_count INT UNSIGNED NOT NULL DEFAULT 0,
36 PRIMARY KEY (`vid`, `nid`, `delta`, `field_name`)
37 );");
38 db_query('CREATE INDEX {link_checker}_last_checked_idx ON {link_checker} (last_checked)');
39 db_query('CREATE INDEX {link_checker}_status_idx ON {link_checker} (status)');
40 break;
41 } // end switch
42
43 // provide the user with some install feedback
44 if ($query) {
45 drupal_set_message(t('Link checker database tables installed'));
46 }
47 else {
48 drupal_set_message(t('Table install for link checker was unsuccessful.'));
49 }
50 } // end install function
51
52 function link_checker_update_1() {
53 if(variable_get('link_checker_unpublish', NULL)) {
54 variable_set('link_checker_unpublish', 1);
55 }
56 $ret = update_sql("ALTER TABLE link_checker add column error_count int default 0;");
57 return $ret;
58
59 }
60
61 /*
62 * Implementation of hook_uninstall()
63 */
64 function link_checker_uninstall() {
65 db_query('DROP TABLE {link_checker}');
66 db_query("DELETE FROM {variable} WHERE name like '%link_checker%'");
67 }
68

  ViewVC Help
Powered by ViewVC 1.1.2