/[drupal]/contributions/modules/gsitemap/xmlsitemap.install
ViewVC logotype

Contents of /contributions/modules/gsitemap/xmlsitemap.install

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


Revision 1.5 - (show annotations) (download) (as text)
Mon May 7 04:31:10 2007 UTC (2 years, 6 months ago) by darrenoh
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +44 -5 lines
File MIME type: text/x-php
Updated for Drupal 6.
1 <?php
2 // $Id: xmlsitemap.install,v 1.4 2007/05/06 22:56:43 darrenoh Exp $
3
4 /**
5 * Implementation of hook_install().
6 */
7 function xmlsitemap_install() {
8 switch ($GLOBALS['db_type']) {
9 case 'mysql':
10 case 'mysqli':
11 db_query("CREATE TABLE {xmlsitemap} (
12 nid int,
13 pid int,
14 last_changed int(11),
15 previously_changed int(11),
16 last_comment int(11),
17 previous_comment int(11),
18 priority_override decimal(2,1),
19 PRIMARY KEY (nid)
20 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
21 db_query("CREATE TABLE {xmlsitemap_additional} (
22 path varchar(128) NOT NULL default '',
23 pid int,
24 last_changed int(11),
25 previously_changed int(11),
26 priority decimal(2,1),
27 PRIMARY KEY (path)
28 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
29 break;
30 case 'pgsql':
31 db_query("CREATE TABLE {xmlsitemap} (
32 nid integer,
33 pid integer,
34 last_changed integer,
35 previously_changed integer,
36 last_comment integer,
37 previous_comment integer,
38 priority_override real,
39 PRIMARY KEY (nid)
40 );");
41 db_query("CREATE TABLE {xmlsitemap_additional} (
42 path varchar(128) NOT NULL default '',
43 pid integer,
44 last_changed integer,
45 previously_changed integer,
46 priority real,
47 PRIMARY KEY (path)
48 );");
49 break;
50 }
51 $gsitemap = db_result(db_query("SELECT status FROM {system} WHERE type = 'module' AND name = '%s'", 'gsitemap'));
52 if ($gsitemap === 1 || $gsitemap === 0) {
53 _xmlsitemap_gsitemap();
54 }
55 }
56
57 /**
58 * Replace gsitemap tables and variables with xmlsitemap tables and
59 * variables.
60 * @return Nothing
61 */
62 function _xmlsitemap_gsitemap() {
63 db_query('INSERT INTO {xmlsitemap} SELECT * FROM {gsitemap}');
64 db_query('DROP TABLE {gsitemap}');
65 db_query('INSERT INTO {xmlsitemap_additional} SELECT * FROM {gsitemap_additional}');
66 db_query('DROP TABLE {gsitemap_additional}');
67 variable_set('xmlsitemap_ask_com_submit', variable_get('gsitemap_ask_com_submit', FALSE));
68 variable_del('gsitemap_ask_com_submit');
69 variable_set('xmlsitemap_ask_com_url', variable_get('gsitemap_ask_com_url', 'http://submissions.ask.com/ping?sitemap='. url('sitemap.xml', array('absolute' => TRUE))));
70 variable_del('gsitemap_ask_com_url');
71 variable_set('xmlsitemap_changed', variable_get('gsitemap_changed', FALSE));
72 variable_del('gsitemap_changed');
73 variable_set('xmlsitemap_chunk_size', variable_get('gsitemap_chunk_size', 50000));
74 variable_del('gsitemap_chunk_size');
75 variable_set('xmlsitemap_chunk_count', variable_get('gsitemap_chunk_count', 0));
76 variable_del('gsitemap_chunk_count');
77 variable_set('xmlsitemap_commentwt', variable_get('gsitemap_commentwt', '0.5'));
78 variable_del('gsitemap_commentwt');
79 variable_set('xmlsitemap_countcom', variable_get('gsitemap_countcom', 1));
80 variable_del('gsitemap_countcom');
81 variable_set('xmlsitemap_cron_submit', variable_get('gsitemap_cron_submit', 0));
82 variable_del('gsitemap_cron_submit');
83 variable_set('xmlsitemap_frontpage', variable_get('gsitemap_frontpage', '1.0'));
84 variable_del('gsitemap_frontpage');
85 variable_set('xmlsitemap_google_submit', variable_get('gsitemap_google_submit', TRUE));
86 variable_del('gsitemap_google_submit');
87 variable_set('xmlsitemap_google_url', variable_get('gsitemap_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap='. url('sitemap.xml', array('absolute' => TRUE))));
88 variable_del('gsitemap_google_url');
89 variable_set('xmlsitemap_logacc', variable_get('gsitemap_logacc', FALSE));
90 variable_del('gsitemap_logacc');
91 variable_set('xmlsitemap_priority', variable_get('gsitemap_priority', '0.5'));
92 variable_del('gsitemap_priority');
93 variable_set('xmlsitemap_promotewt', variable_get('gsitemap_promotewt', '0.3'));
94 variable_del('gsitemap_promotewt');
95 variable_set('xmlsitemap_showterms', variable_get('gsitemap_showterms', FALSE));
96 variable_del('gsitemap_showterms');
97 variable_set('xmlsitemap_showusers', variable_get('gsitemap_showusers', FALSE));
98 variable_del('gsitemap_showusers');
99 variable_set('xmlsitemap_submit', variable_get('gsitemap_submit', FALSE));
100 variable_del('gsitemap_submit');
101 variable_set('xmlsitemap_update', variable_get('gsitemap_update', FALSE));
102 variable_del('gsitemap_update');
103 variable_set('xmlsitemap_verify', variable_get('gsitemap_verify', ''));
104 variable_del('gsitemap_verify');
105 variable_set('xmlsitemap_yahoo_submit', variable_get('gsitemap_yahoo_submit', FALSE));
106 variable_del('gsitemap_yahoo_submit');
107 variable_set('xmlsitemap_yahoo_url', variable_get('gsitemap_yahoo_url', 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap='. url('sitemap.xml', array('absolute' => TRUE))));
108 variable_del('gsitemap_yahoo_url');
109 foreach (node_get_types('names') as $type => $name) {
110 variable_set('xmlsitemap_'. $type .'wt', variable_get('gsitemap_'. $type .'wt', '0.1'));
111 variable_del('gsitemap_'. $type .'wt');
112 }
113 drupal_set_installed_schema_version('gsitemap', SCHEMA_UNINSTALLED);
114 }
115
116 /**
117 * Implementation of hook_enable().
118 */
119 function xmlsitemap_enable() {
120 _xmlsitemap_update_cache();
121 }
122
123 /**
124 * Implementation of hook_uninstall().
125 */
126 function xmlsitemap_uninstall() {
127 db_query('DROP TABLE {xmlsitemap}');
128 db_query('DROP TABLE {xmlsitemap_additional}');
129 variable_del('xmlsitemap_ask_com_submit');
130 variable_del('xmlsitemap_ask_com_url');
131 variable_del('xmlsitemap_changed');
132 variable_del('xmlsitemap_chunk_size');
133 variable_del('xmlsitemap_chunk_count');
134 variable_del('xmlsitemap_commentwt');
135 variable_del('xmlsitemap_countcom');
136 variable_del('xmlsitemap_cron_submit');
137 variable_del('xmlsitemap_frontpage');
138 variable_del('xmlsitemap_google_submit');
139 variable_del('xmlsitemap_google_url');
140 variable_del('xmlsitemap_logacc');
141 variable_del('xmlsitemap_priority');
142 variable_del('xmlsitemap_promotewt');
143 variable_del('xmlsitemap_showterms');
144 variable_del('xmlsitemap_showusers');
145 variable_del('xmlsitemap_submit');
146 variable_del('xmlsitemap_update');
147 variable_del('xmlsitemap_verify');
148 variable_del('xmlsitemap_yahoo_submit');
149 variable_del('xmlsitemap_yahoo_url');
150 foreach (node_get_types('names') as $type => $name) {
151 variable_del('xmlsitemap_'. $type .'wt');
152 }
153 }
154

  ViewVC Help
Powered by ViewVC 1.1.2