You are here

nodewords_basic.install in Nodewords: D6 Meta Tags 6

Installation file for nodewords_basic.module.

File

nodewords_basic/nodewords_basic.install
View source
<?php

/**
 * @file
 * Installation file for nodewords_basic.module.
 */

/**
 * Implements hook_install().
 */
function nodewords_basic_install() {
  db_query("UPDATE {system} SET weight = 12 WHERE name = 'nodewords_basic' AND type = 'module'");
}

/**
 * Implements hook_uninstall().
 */
function nodewords_basic_uninstall() {
  if (db_table_exists('nodewords')) {
    $metatags = array(
      'abstract',
      'attribute-source',
      'canonical',
      'description',
      'keywords',
      'revisit-after',
      'rights',
      'robots',
      'syndication-source',
    );
    db_query("DELETE FROM {nodewords} WHERE name IN (" . db_placeholders($metatags, 'varchar') . ")", $metatags);
  }
}

/**
 * Implementations of hook_update_N().
 */

/**
 * Update old versions to 6.x-1.13-x. We had to jump to 6113 because 6.x-1.12-
 * releases had already jumped to 6112, so updating would try running *all*
 * updates and could potentially break the site.
 */
function nodewords_basic_update_6113() {
  return array();
}

/**
 * Change the Canonical URL's path-alias variable to a new global one instead.
 */
function nodewords_basic_update_6114() {
  $ret = array();
  variable_set('nodewords_use_path_alias', variable_get('nodewords_canonical_alias', TRUE));
  variable_del('nodewords_canonical_alias');
  return $ret;
}

/**
 * Remove the 'syndication-source' meta tag that was deprecated.
 */
function nodewords_basic_update_6115() {
  if (db_table_exists('nodewords')) {
    $metatags = array(
      'syndication-source',
    );
    db_query("DELETE FROM {nodewords} WHERE name IN (" . db_placeholders($metatags, 'varchar') . ")", $metatags);
  }
}

/**
 * Convert the 'name' field from "copyright" to "rights" for existing records.
 */
function nodewords_basic_update_6116() {
  $ret = array();

  // Check to see if any records need to be updated.
  $count = db_result(db_query("SELECT COUNT(mtid) FROM {nodewords} WHERE name='copyright'"));

  // Update the records.
  if ($count) {
    $ret[] = update_sql("UPDATE {nodewords} SET name='rights' WHERE name='copyright'");
    drupal_set_message(t('Converted @count "copyright" meta tags to "rights" meta tags.', array(
      '@count' => $count,
    )));
  }
  return $ret;
}

Functions

Namesort descending Description
nodewords_basic_install Implements hook_install().
nodewords_basic_uninstall Implements hook_uninstall().
nodewords_basic_update_6113 Update old versions to 6.x-1.13-x. We had to jump to 6113 because 6.x-1.12- releases had already jumped to 6112, so updating would try running *all* updates and could potentially break the site.
nodewords_basic_update_6114 Change the Canonical URL's path-alias variable to a new global one instead.
nodewords_basic_update_6115 Remove the 'syndication-source' meta tag that was deprecated.
nodewords_basic_update_6116 Convert the 'name' field from "copyright" to "rights" for existing records.