/[drupal]/contributions/modules/seo_checklist/seochecklist.install
ViewVC logotype

Contents of /contributions/modules/seo_checklist/seochecklist.install

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


Revision 1.13 - (show annotations) (download) (as text)
Tue Nov 3 22:52:05 2009 UTC (3 weeks, 1 day ago) by davereid
Branch: MAIN
CVS Tags: DRUPAL-6--2-1-BETA1, HEAD
Changes since 1.12: +11 -2 lines
File MIME type: text/x-php
#618772 by zolikonta, Dave Reid: Fixed link to Google Local Business Center.
1 <?php
2 // $Id: seochecklist.install,v 1.12 2009/10/29 01:51:48 davereid Exp $
3
4 /**
5 * @file
6 * Install, update and uninstall functions for the seochecklist module.
7 */
8
9 /**
10 * Implementation of hook_schema().
11 */
12 function seochecklist_schema() {
13 $schema['seo_group'] = array(
14 'description' => 'seo_group',
15 'fields' => array(
16 'id' => array(
17 'type' => 'serial',
18 'size' => 'tiny',
19 'not null' => TRUE,
20 'description' => 'id',
21 'disp-width' => '4'
22 ),
23 'name' => array(
24 'type' => 'varchar',
25 'length' => '255',
26 'not null' => TRUE,
27 'description' => 'name',
28 'default' => ''
29 ),
30 'description' => array(
31 'type' => 'varchar',
32 'length' => '255',
33 'not null' => TRUE,
34 'description' => 'description',
35 'default' => ''
36 ),
37 ),
38 'primary key' => array('id'),
39 );
40 $schema['seo_checklist'] = array(
41 'description' => 'seo_checklist',
42 'fields' => array(
43 'id' => array(
44 'type' => 'serial',
45 'size' => 'tiny',
46 'not null' => TRUE,
47 'description' => 'id',
48 ),
49 'group_id' => array(
50 'type' => 'int',
51 'size' => 'tiny',
52 'not null' => TRUE,
53 'default' => 0,
54 'description' => 'group_id',
55 ),
56 'name' => array(
57 'type' => 'varchar',
58 'length' => '255',
59 'not null' => TRUE,
60 'description' => 'name',
61 'default' => '',
62 ),
63 'module' => array(
64 'type' => 'varchar',
65 'length' => '255',
66 'not null' => TRUE,
67 'description' => 'module',
68 'default' => '',
69 ),
70 'download' => array(
71 'type' => 'varchar',
72 'length' => '255',
73 'not null' => TRUE,
74 'description' => 'download',
75 'default' => '',
76 ),
77 'enable' => array(
78 'type' => 'varchar',
79 'length' => '255',
80 'not null' => TRUE,
81 'description' => 'enable',
82 'default' => '',
83 ),
84 'configure' => array(
85 'type' => 'varchar',
86 'length' => '255',
87 'not null' => TRUE,
88 'description' => 'configure',
89 'default' => '',
90 ),
91 'order_id' => array(
92 'type' => 'int',
93 'size' => 'tiny',
94 'not null' => TRUE,
95 'description' => 'order id',
96 'default' => 0,
97 ),
98 'completed' => array(
99 'type' => 'int',
100 'unsigned' => TRUE,
101 'not null' => TRUE,
102 'default' => 0,
103 'description' => 'UNIX timestamp of when this task was completed, or 0 if the task has not yet been completed.',
104 ),
105 'uid' => array(
106 'type' => 'int',
107 'unsigned' => TRUE,
108 'not null' => TRUE,
109 'default' => 0,
110 'description' => 'The {user}.uid of the account that completed this task.',
111 ),
112 ),
113 'primary key' => array('id'),
114 );
115 return $schema;
116 }
117
118 /**
119 * Implementation of hook_install().
120 */
121 function seochecklist_install() {
122 drupal_install_schema('seochecklist');
123
124 $task_fields = "(id, group_id, name, module, download, enable, configure, order_id)";
125
126 // Page title tasks
127 db_query("INSERT INTO {seo_group} VALUES (1, 'Page Titles', 'The single most important thing you can do for on-site SEO.')");
128 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (41, 1, 'Token (required for other modules to function)', 'token', 'http://drupal.org/project/token', 'admin/build/modules', '', 1)");
129 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (1, 1, 'Page Title Module', 'page_title', 'http://drupal.org/project/page_title', 'admin/build/modules', 'admin/content/page_title', 2)");
130
131 // URL tasks
132 db_query("INSERT INTO {seo_group} VALUES (2, 'URL paths', 'The second most important thing you can do.')");
133 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (2, 2, 'Clean URLs - Activate (Usually automatic. Please double-check!)', '', '', '', 'admin/settings/clean-urls', 1)");
134 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (5, 2, 'Pathauto Module', 'pathauto', 'http://drupal.org/project/pathauto', 'admin/build/modules', 'admin/build/path/pathauto', 2)");
135 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (6, 2, 'Global Redirect Module', 'globalredirect', 'http://drupal.org/project/globalredirect', 'admin/build/modules', '', 3)");
136 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (38, 2, 'Path Redirect Module', 'path_redirect', 'http://drupal.org/project/path_redirect', 'admin/build/modules', '', 4)");
137
138 // Search engine account tasks
139 db_query("INSERT INTO {seo_group} VALUES (3, 'Create Search Engine Accounts', 'Set yourself up with the search engines.')");
140 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (7, 3, 'Get a Google Account - You will need this for several of the steps that follow - <a href=\"https://www.google.com/accounts/NewAccount\">https://www.google.com/accounts/NewAccount</a>', '', '', '', '', 1)");
141 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (8, 3, 'Get a Yahoo Account - You will need this for steps that follow - <a href=\"http://www.yahoo.com/r/m7\">http://www.yahoo.com/r/m7</a>', '', '', '', '', 2)");
142 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (44, 3, 'Get a Windows Live ID - You will need this for steps that follow - <a href=\"https://signup.live.com/\">https://signup.live.com/</a>', '', '', '', '', 2)");
143
144 // Visitor tracking tasks
145 db_query("INSERT INTO {seo_group} VALUES (4, 'Track your visitors', 'Know where your visitors are coming from and what they do while visiting your site.')");
146 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (9, 4, 'Google Analytics Module', 'googleanalytics', 'http://drupal.org/project/google_analytics', 'admin/build/modules', 'admin/settings/googleanalytics', 1)");
147 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (10, 4, 'Sign in to your Google Analytics Account - <a href=\"http://www.google.com/analytics\">http://www.google.com/analytics</a>', '', '', '', '', 2)");
148 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (11, 4, 'Create an Analytics for your website', '', '', '', '', 3)");
149 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (12, 4, 'Paste Google Analytics code into Google Analytics Module', '', '', '', '', 4)");
150 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (13, 4, 'Authenticate your site with Google Analytics', '', '', '', '', 5)");
151
152 // Page content tasks
153 db_query("INSERT INTO {seo_group} VALUES (5, 'Page content', 'Take control of your page content.')");
154 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (15, 5, 'Meta Tags Module (AKA Nodewords)', 'nodewords', 'http://drupal.org/project/nodewords', 'admin/build/modules', 'admin/content/nodewords', 2)");
155 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (16, 5, 'Scheduler Module', 'scheduler', 'http://drupal.org/project/scheduler', 'admin/build/modules', 'admin/settings/scheduler', 3)");
156 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (17, 5, 'HTML Purifier Module', 'htmlpurifier', 'http://drupal.org/project/htmlpurifier', 'admin/build/modules', 'admin/settings/filters/1', 4)");
157 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (45, 5, '<a href=\"/sites/all/modules/htmlpurifier/INSTALL.txt\">READ THE INSTALL INSTRUCTIONS!</a> then Download HTML Purifier. You will need
158 3.1.0rc1 or later. - <a href=\"http://htmlpurifier.org/\">http://htmlpurifier.org/</a>', '', '', '', '', 5)");
159 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (18, 5, 'Search 404 Module', 'search404', 'http://drupal.org/project/search404', 'admin/build/modules', 'admin/settings/search404', 5)");
160
161 // Source code tasks
162 db_query("INSERT INTO {seo_group} VALUES (6, 'Clean code', 'Well written markup is very important to the search engine spiders.')");
163 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (19, 6, 'Validate your site - <a href=\"http://validator.w3.org/\">http://validator.w3.org/</a>', '', '', '', '', 1)");
164 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (20, 6, 'Check your links - <a href=\"http://validator.w3.org/checklink\">http://validator.w3.org/checklink</a>', '', '', '', '', 2)");
165
166 // XML sitemap tasks
167 db_query("INSERT INTO {seo_group} VALUES (7, 'Submit your Site to the search engines.', 'Now that you\'ve got your site ready for the search engines, tell them about it!')");
168 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (21, 7, 'XML Sitemap Module', 'xmlsitemap', 'http://drupal.org/project/xmlsitemap', 'admin/build/modules', 'admin/settings/xmlsitemap', 1)");
169 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (46, 7, 'Site Map Module - a plain text sitemap', 'site_map', 'http://drupal.org/project/site_map', 'admin/build/modules', 'admin/settings/sitemap', 3)");
170 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (22, 7, 'Login to Google Webmaster Tools - <a href=\"http://www.google.com/webmasters/tools\">http://www.google.com/webmasters/tools</a>', '', '', '', '', 5)");
171 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (23, 7, 'Authenticate your site with Google', '', '', '', '', 7)");
172 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (24, 7, 'Submit your XML Sitemap to Google - <a href=\"http://www.google.com/webmasters/sitemaps/\">http://www.google.com/webmasters/sitemaps/</a>', '', '', '', '', 9)");
173 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (25, 7, 'Login to Yahoo Site Explorer Account - <a href=\"https://siteexplorer.search.yahoo.com/\">https://siteexplorer.search.yahoo.com/</a>', '', '', '', '', 11)");
174 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (26, 7, 'Authenticate your site with Yahoo', '', '', '', '', 13)");
175 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (27, 7, 'Submit your XML Sitemap to Yahoo - <a href=\"https://siteexplorer.search.yahoo.com/submit\">https://siteexplorer.search.yahoo.com/submit</a>', '', '', '', '', 15)");
176 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (42, 7, 'Login to Bing - <a href=\"http://www.bing.com/webmaster/\">http://www.bing.com/webmaster/</a>', '', '', '', '', 17)");
177 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (43, 7, 'Authenticate your site with Bing', '', '', '', '', 19)");
178 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (28, 7, 'Submit your XML Sitemap to Bing - <a href=\"http://www.bing.com/webmaster/WebmasterAddSitesPage.aspx\">http://webmaster.live.com/webmaster/WebmasterAddSitesPage.aspx</a>', '', '', '', '', 21)");
179 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (29, 7, 'If appropriate, submit your company to Google Local Business Center - <a href=\"https://www.google.com/local/add/login\">https://www.google.com/local/add/login</a>', '', '', '', '', 23)");
180
181 // Social links tasks
182 db_query("INSERT INTO {seo_group} VALUES (8, 'Social Tracking', 'Using Social news sites, blogs, etc? Consider these:')");
183 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (30, 8, 'Digg This Module', 'diggthis', 'http://drupal.org/project/diggthis', 'admin/build/modules', 'admin/settings/diggthis', 1)");
184 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (31, 8, 'Service Links Module', 'service_links', 'http://drupal.org/project/service_links', 'admin/build/modules', 'admin/settings/service_links', 2)");
185 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (32, 8, 'Trackback Module', 'trackback', 'http://drupal.org/project/trackback', 'admin/build/modules', 'admin/settings/trackback', 3)");
186
187 // Spam tasks
188 db_query("INSERT INTO {seo_group} VALUES (9, 'Protect your site from Spam', 'If your site will get heavy use from visitors creating accounts, commenting and/or creating content then consider these. NOTE: Most sites just need Mollom. The other modules are here in case Mollom does not work for you for some reason.')");
189 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (40, 9, 'HIGHLY RECOMMENDED: Sign up for Mollom\'s free service and get Mollom code - <a href=\"http://mollom.com/user/register\"> http://mollom.com/user/register</a>', '', '', '', '', 0)");
190 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (39, 9, 'HIGHLY RECOMMENDED: Mollom Module', 'mollom', 'http://drupal.org/project/mollom', 'admin/build/modules', 'admin/settings/mollom', 1)");
191 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (33, 9, 'Captcha Module', 'captcha', 'http://drupal.org/project/captcha', 'admin/build/modules', 'admin/user/captcha', 2)");
192 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (34, 9, 'Akismet Module', 'akismet', 'http://drupal.org/project/akismet', 'admin/build/modules', 'admin/settings/akismet', 3)");
193 db_query("INSERT INTO {seo_checklist} $task_fields VALUES (36, 9, 'Spam Module', 'spam', 'http://drupal.org/project/spam', 'admin/build/modules', 'admin/settings/spam', 4)");
194 }
195
196 /**
197 * Implementation of hook_uninstall().
198 */
199 function seochecklist_uninstall() {
200 drupal_uninstall_schema('seochecklist');
201 variable_del('seo_checklist_link');
202 variable_del('seo_checklist_thanks');
203 variable_del('seo_checklist_podcast');
204 variable_del('seo_checklist_book_references');
205 }
206
207 /**
208 * Update from 6.x-1.x to 6.x-2.x.
209 */
210 function seochecklist_update_6001() {
211 $ret = array();
212
213 $query = db_query("SELECT linked_seo FROM {seo_checklist} ORDER BY id DESC LIMIT 1");
214 $result = db_fetch_object($query);
215 variable_set('seo_checklist_link', intval($result->linked_seo));
216
217 $query = db_query("SELECT extra2, extra3 FROM {seo_checklist} WHERE id = 1");
218 $result = db_fetch_object($query);
219 variable_set('seo_checklist_thanks', intval($result->extra2));
220 variable_set('seo_checklist_podcast', intval($result->extra3));
221
222 db_drop_field($ret, 'seo_checklist', 'extra2');
223 db_drop_field($ret, 'seo_checklist', 'extra3');
224 db_drop_field($ret, 'seo_checklist', 'linked_seo');
225 db_drop_field($ret, 'seo_group', 'subgroup');
226 db_drop_table($ret, 'seo_subgroup');
227
228 return $ret;
229 }
230
231 /**
232 * Fix the link in the clean URL task.
233 */
234 function seochecklist_update_6202() {
235 $ret = array();
236 $ret[] = update_sql("UPDATE {seo_checklist} SET name = 'Clean URLs - Activate (Usually automatic. Please double-check!)', configure = 'admin/settings/clean-urls' WHERE id = 2");
237 return $ret;
238 }
239
240 /**
241 * Update from Live to Bing and fix links.
242 */
243 function seochecklist_update_6203() {
244 $ret = array();
245 $ret[] = update_sql("UPDATE {seo_checklist} SET name = 'Get a Windows Live ID - You will need this for steps that follow - <a href=\"https://signup.live.com/\">https://signup.live.com/</a>' WHERE id = 44");
246 $ret[] = update_sql("UPDATE {seo_checklist} SET name = 'Login to Bing - <a href=\"http://www.bing.com/webmaster/\">http://www.bing.com/webmaster/</a>', order_id = 17 WHERE id = 42");
247 $ret[] = update_sql("UPDATE {seo_checklist} SET name = 'Authenticate your site with Bing', order_id = 19 WHERE id = 43");
248 $ret[] = update_sql("UPDATE {seo_checklist} SET name = 'Submit your XML Sitemap to Bing - <a href=\"http://www.bing.com/webmaster/WebmasterAddSitesPage.aspx\">http://webmaster.live.com/webmaster/WebmasterAddSitesPage.aspx</a>', order_id = 21 WHERE id = 28");
249 $ret[] = update_sql("UPDATE {seo_checklist} SET module = 'xmlsitemap' WHERE id = 21");
250 return $ret;
251 }
252
253 /**
254 * Convert the date_changed and option_checked fields into one UNIX completed
255 * field.
256 */
257 function seochecklist_update_6204() {
258 $ret = array();
259
260 db_add_field($ret, 'seo_checklist', 'completed', array(
261 'type' => 'int',
262 'unsigned' => TRUE,
263 'not null' => TRUE,
264 'default' => 0,
265 'description' => 'UNIX timestamp of when this task was completed.',
266 ));
267
268 $query = db_query("SELECT id, date_changed FROM {seo_checklist} WHERE option_checked <> 0");
269 while ($record = db_fetch_object($query)) {
270 $record->changed = strtotime($record->date_changed);
271 if (!$record->changed) {
272 $record->changed = time();
273 }
274 $ret[] = update_sql("UPDATE {seo_checklist} SET completed = {$record->changed} WHERE id = {$record->id}");
275 }
276
277 db_drop_field($ret, 'seo_checklist', 'date_changed');
278 db_drop_field($ret, 'seo_checklist', 'option_checked');
279 db_drop_field($ret, 'seo_checklist', 'checked_module');
280
281 return $ret;
282 }
283
284 /**
285 * Remove the {seo_checklist}.subgroup_id field and add {seo_checklist}.uid.
286 */
287 function seochecklist_update_6205() {
288 $ret = array();
289 db_drop_field($ret, 'seo_checklist', 'subgroup_id');
290 db_add_field($ret, 'seo_checklist', 'uid', array(
291 'type' => 'int',
292 'unsigned' => TRUE,
293 'not null' => TRUE,
294 'default' => 0,
295 'description' => 'The {user}.uid of the account that completed this task.',
296 ));
297 $ret[] = update_sql("UPDATE {seo_checklist} SET module = LOWER(module)");
298 return $ret;
299 }
300
301 /**
302 * Fixed the link to Google Local Business Center.
303 */
304 function seochecklist_update_6206() {
305 $ret = array();
306 $ret[] = update_sql("UPDATE {seo_checklist} SET name = 'If appropriate, submit your company to Google Local Business Center - <a href=\"https://www.google.com/local/add/login\">https://www.google.com/local/add/login</a>' WHERE id = 29");
307 return $ret;
308 }

  ViewVC Help
Powered by ViewVC 1.1.2