You are here

function seochecklist_install in SEO Checklist 5.2

Same name and namespace in other branches
  1. 5 SEOChecklist.install \SEOChecklist_install()
  2. 6.3 seochecklist.install \seochecklist_install()
  3. 6.2 seochecklist.install \seochecklist_install()
  4. 7.3 seochecklist.install \seochecklist_install()

Implementation of hook_install().

File

./seochecklist.install, line 11
Install, update and uninstall functions for the seochecklist module.

Code

function seochecklist_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {seo_group} (\n        id tinyint NOT NULL auto_increment,\n        name varchar(255) NOT NULL default '',\n        description varchar(255) NOT NULL default '',\n        PRIMARY KEY (id)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {seo_checklist} (\n        id tinyint NOT NULL auto_increment,\n        group_id tinyint NOT NULL default '0',\n        name varchar(255) NOT NULL default '',\n        module varchar(255) NOT NULL default '',\n        download varchar(255) NOT NULL default '',\n        enable varchar(255) NOT NULL default '',\n        configure varchar(255) NOT NULL default '',\n        order_id tinyint NOT NULL default '0',\n        completed int unsigned NOT NULL default '0',\n        uid int unsigned NOT NULL default '0',\n        PRIMARY KEY (id)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {seo_group} (\n        id serial CHECK (id >= 0),\n        name varchar(255) NOT NULL default '',\n        description varchar(255) NOT NULL default '',\n        PRIMARY KEY (id)\n      )");
      db_query("CREATE TABLE {seo_checklist} (\n        id serial CHECK (id >= 0),\n        group_id smallint NOT NULL default '0',\n        name varchar(255) NOT NULL default '',\n        module varchar(255) NOT NULL default '',\n        download varchar(255) NOT NULL default '',\n        enable varchar(255) NOT NULL default '',\n        configure varchar(255) NOT NULL default '',\n        order_id smallint NOT NULL default '0',\n        completed int_unsigned NOT NULL default '0',\n        uid int_unsigned NOT NULL default '0',\n        PRIMARY KEY (id)\n      )");
      break;
  }
  $task_fields = "(id, group_id, name, module, download, enable, configure, order_id)";

  // Page title tasks
  db_query("INSERT INTO {seo_group} VALUES (1, 'Page Titles', 'The single most important thing you can do for on-site SEO.')");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (39, 1, 'Token (required for other modules to function)', 'token', 'http://drupal.org/project/token', 'admin/build/modules', '', 1)");
  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)");

  // URL tasks
  db_query("INSERT INTO {seo_group} VALUES (2, 'URL paths', 'The second most important thing you can do.')");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (2, 2, 'Clean URLs - Activate (Usually automatic. Please double-check!)', '', '', '', 'admin/settings/clean-urls', 1)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (3, 2, 'Find URL Alias Module', 'find_path', 'http://drupal.org/project/find_path', 'admin/build/modules', '', 2)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (6, 2, 'Global Redirect Module', 'globalredirect', 'http://drupal.org/project/globalredirect', 'admin/build/modules', '', 3)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (4, 2, 'Simple: URLify Module', 'urlify', 'http://drupal.org/project/urlify', 'admin/build/modules', 'settings', 1)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (5, 2, 'Powerful: Pathauto Module', 'pathauto', 'http://drupal.org/project/pathauto', 'admin/build/modules', 'admin/settings/pathauto', 2)");

  // Search engine account tasks
  db_query("INSERT INTO {seo_group} VALUES (3, 'Create Search Engine Accounts', 'Set yourself up with the search engines.')");
  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)");
  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)");
  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>', '', '', '', '', 3)");

  // Visitor tracking tasks
  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.')");
  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)");
  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)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (11, 4, 'Create an Analytics for your website', '', '', '', '', 3)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (12, 4, 'Paste Google Analytics code into Google Analytics Module', '', '', '', '', 4)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (13, 4, 'Authenticate your site with Google Analytics', '', '', '', '', 5)");

  // Page content tasks
  db_query("INSERT INTO {seo_group} VALUES (5, 'Page content', 'Take control of your page content.')");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (14, 5, 'Excerpt Module', 'excerpt', 'http://drupal.org/project/excerpt', 'admin/build/modules', '', 1)");
  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)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (16, 5, 'Scheduler Module', 'scheduler', 'http://drupal.org/project/scheduler', 'admin/build/modules', '', 3)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (17, 5, 'Safe HTML Module', 'safehtml', 'http://drupal.org/project/safehtml', 'admin/build/modules', 'admin/settings/filters/1', 4)");
  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)");

  // Source code tasks
  db_query("INSERT INTO {seo_group} VALUES (6, 'Clean code', 'Well written markup is very important to the search engine spiders.')");
  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)");
  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)");

  // XML sitemap tasks
  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!')");
  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)");
  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>', '', '', '', '', 2)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (23, 7, 'Authenticate your site with Google', '', '', '', '', 3)");
  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>', '', '', '', '', 4)");
  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>', '', '', '', '', 5)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (26, 7, 'Authenticate your site with Yahoo', '', '', '', '', 6)");
  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>', '', '', '', '', 7)");
  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>', '', '', '', '', 8)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (43, 7, 'Authenticate your site with Bing', '', '', '', '', 9)");
  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>', '', '', '', '', 10)");
  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>', '', '', '', '', 11)");

  // Social links tasks
  db_query("INSERT INTO {seo_group} VALUES (8, 'Social Tracking', 'Using Social news sites, blogs, etc? Consider these:')");
  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)");
  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)");
  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)");

  // Spam tasks
  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.')");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (40, 9, 'Mollom Module', 'mollom', 'http://drupal.org/project/mollom', 'admin/build/modules', 'admin/settings/mollom', 1)");
  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)");
  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)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (35, 9, 'http:BL Module', 'httpbl', 'http://drupal.org/project/httpbl', 'admin/build/modules', 'admin/settings/httpbl', 4)");
  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', 5)");

  // Beta modules
  db_query("INSERT INTO {seo_group} VALUES (10, 'Beta Modules (Use with Caution!)', 'These are probably good modules but need some work. Test them first.')");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (37, 10, 'Google Proxy Hacking Protector Module', 'antiproxyhack', 'http://drupal.org/project/antiproxyhack', 'admin/build/modules', '', 1)");
  db_query("INSERT INTO {seo_checklist} {$task_fields} VALUES (38, 10, 'Path Redirect Module', 'path_redirect', 'http://drupal.org/project/path_redirect', 'admin/build/modules', '', 2)");
}