nodewords.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodewords/nodewords.install,v
retrieving revision 1.10.2.142
diff -u -p -r1.10.2.142 nodewords.install
--- nodewords.install	12 Dec 2009 00:03:00 -0000	1.10.2.142
+++ nodewords.install	14 Dec 2009 22:44:51 -0000
@@ -50,17 +50,18 @@ function nodewords_schema() {
       ),
       'type' => array(
         'description' => 'The type of object to which the meta tag refers (node, user, page, etc...).',
-        'type' => 'varchar',
-        'length' => 16,
+        'type' => 'int',
+        'size' => 'small',
+        'unsigned' => TRUE,
         'not null' => TRUE,
-        'default' => '',
+        'default' => 0,
       ),
       'id' => array(
         'description' => 'The object ID.',
-        'type' => 'varchar',
-        'length' => 255,
+        'type' => 'int',
+        'unsigned' => TRUE,
         'not null' => TRUE,
-        'default' => '',
+        'default' => 0,
       ),
       'name' => array(
         'description' => 'The meta tag name.',
@@ -78,17 +79,10 @@ function nodewords_schema() {
     ),
     'indexes' => array(
       'nodewords_name' => array(array('name', 6)),
-      'nodewords_type_id' => array(
-        array('type', 6),
-        array('id', 6),
-      ),
+      'nodewords_type_id' => array('type', 'id'),
     ),
     'unique keys' => array(
-      'nodewords_type_id_name' => array(
-        'type',
-        'id',
-        'name',
-      ),
+      'nodewords_type_id_name' => array('type', 'id', 'name'),
     ),
     'primary key' => array('mtid'),
   );
@@ -230,7 +224,7 @@ function nodewords_update_6100() {
 
   $ret[] = array(
     'success' => TRUE,
-    'query' => 'CREATE NEW SETTING VARIABLES',
+    'query' => 'Created new setting variables.',
   );
 
   return $ret;
@@ -286,7 +280,10 @@ function nodewords_update_6102() {
 
   variable_del('nodewords_global');
 
-  drupal_set_message('The default meta tags values have been updated; verify they have the correct values in the <a href="'. url('admin/content/nodewords/meta-tags/default') . '">module settings page</a>.');
+  $ret[] = array(
+    'success' => TRUE,
+    'query' => check_plain('The default meta tags values have been updated; verify they have the correct values at ' . url('admin/content/nodewords/meta-tags/default', array('absolute' => TRUE))),
+  );
 
   return $ret;
 }
@@ -330,7 +327,7 @@ function nodewords_update_6104() {
 
   $ret[] = array(
     'success' => TRUE,
-    'query' => 'UPDATE MODULE SETTINGS',
+    'query' => 'Updated the module settings.',
   );
 
   return $ret;
@@ -537,7 +534,10 @@ function nodewords_update_6117() {
   $ret[] = update_sql("DELETE FROM {nodewords} WHERE type IN ('views', 'panels')");
 
   if (db_affected_rows()) {
-    drupal_set_message('The support for Views, and Panels have been changed; visit the <a href="'. url('admin/content/nodewords/meta-tags/other') . '">administration page</a> to edit the meta tags for those pages.');
+    $ret[] = array(
+      'success' => TRUE,
+      'query' => check_plain('The support for Views, and Panels have been changed; visit '. url('admin/content/nodewords/meta-tags/other', array('absolute' => TRUE)) . ' to edit the meta tags for those pages.'),
+    );
   }
 
   return $ret;
@@ -661,7 +661,7 @@ function nodewords_update_6131() {
 
   $ret[] = array(
     'success' => TRUE,
-    'query' => 'UPDATE MODULE VARIABLES',
+    'query' => 'Updated the module settings.',
   );
 
   return $ret;
@@ -777,7 +777,7 @@ function nodewords_update_6140() {
 
   $ret[] = array(
     'success' => TRUE,
-    'query' => 'UPDATE MODULE SETTINGS',
+    'query' => 'Updated the module settings.',
   );
 
   return $ret;
@@ -814,7 +814,10 @@ function nodewords_update_6143() {
       'query' => "UPDATE {variable} SET value = 350 WHERE name = 'nodewords_max_size'",
     );
 
-    drupal_set_message('The default maximum meta tags length has been extended to 350 characters to improve Google results pages. See <a href="http://googleblog.blogspot.com/2009/03/two-new-improvements-to-google-results.html">Two new improvements to Google results pages</a> in the official Google blog for more information.');
+    $ret[] = array(
+      'success' => TRUE,
+      'query' => check_plain('The default maximum meta tags length has been extended to 350 characters to improve Google results pages. See http://googleblog.blogspot.com/2009/03/two-new-improvements-to-google-results.html for more information.'),
+    );
   }
 
   return $ret;
@@ -831,7 +834,7 @@ function nodewords_update_6144() {
 
     $ret[] = array(
       'success' => TRUE,
-      'query' => 'UPDATE MENUS',
+      'query' => 'Updated the menu callback definitions.',
     );
   }
 
@@ -900,10 +903,8 @@ function nodewords_update_6146() {
 
     $ret[] = array(
       'success' => TRUE,
-      'query' => 'RESTORE MODULE SETTINGS',
+      'query' => 'The previous value for the meta tag ROBOTS used in list pages has been restored. Check it is the desired value.',
     );
-
-    drupal_set_message('The previous value for the meta tag ROBOTS used in list pages has been restored. Check it is the desired value.');
   }
 
   $ret[] = update_sql("DELETE FROM {nodewords} WHERE type = '" . NODEWORDS_TYPE_PAGER . "'");
@@ -950,7 +951,7 @@ function nodewords_update_6149() {
 
     $ret[] = array(
       'success' => TRUE,
-      'query' => 'UPDATE MODULE SETTINGS',
+      'query' => 'Updated the module settings.',
     );
   }
 
@@ -962,7 +963,7 @@ function nodewords_update_6149() {
     if (empty($ret)) {
       $ret[] = array(
         'success' => TRUE,
-        'query' => 'UPDATE MODULE SETTINGS',
+        'query' => 'Updated the module settings.',
       );
     }
   }
@@ -1185,6 +1186,126 @@ function nodewords_update_6159(&$sandbox
 }
 
 /**
+ * Implementation of hook_update_N().
+ */
+function nodewords_update_6160(&$sandbox) {
+  $ret = array();
+
+  drupal_load('module', 'nodewords');
+
+  if (!isset($sandbox['progress'])) {
+    $sandbox['progress'] = 0;
+  }
+
+  $old_types = array(
+    'default',
+    'errorpage',
+    'frontpage',
+    'node',
+    'page',
+    'pager',
+    'term',
+    'tracker',
+    'user',
+    'vocabulary',
+  );
+
+  $new_types = array(
+    NODEWORDS_TYPE_DEFAULT,
+    NODEWORDS_TYPE_ERRORPAGE,
+    NODEWORDS_TYPE_FRONTPAGE,
+    NODEWORDS_TYPE_NODE,
+    NODEWORDS_TYPE_PAGE,
+    NODEWORDS_TYPE_PAGER,
+    NODEWORDS_TYPE_TERM,
+    NODEWORDS_TYPE_TRACKER,
+    NODEWORDS_TYPE_USER,
+    NODEWORDS_TYPE_VOCABULARY,
+  );
+
+  $ret[] = update_sql(
+    "UPDATE {nodewords} SET type = " . $new_types[$sandbox['progress']] . " WHERE type = '" . $old_types[$sandbox['progress']++] . "'"
+  );
+
+  $ret['#finished'] = ($sandbox['progress'] / 10);
+
+  return $ret;
+}
+
+/**
+ * Implementation of hook_update_N().
+ */
+function nodewords_update_6161(&$sandbox) {
+  $ret = array();
+
+  drupal_load('module', 'nodewords');
+
+  if (!isset($sandbox['progress'])) {
+    $sandbox['progress'] = 0;
+    $sandbox['max'] = db_result(
+      db_query("SELECT COUNT(*) FROM {nodewords_custom}", NODEWORDS_TYPE_PAGE)
+    );
+    $sandbox['current_pid'] = 0;
+  }
+
+  if ($sandbox['max']) {
+    $metatags = db_query_range(
+      "SELECT * FROM {nodewords_custom} WHERE pid > %d",
+      $sandbox['current_pid'], 0, 10
+    );
+
+    while ($metatag = db_fetch_object($metatags)) {
+      $ret[] = update_sql("UPDATE {nodewords} SET id = " . $metatag->pid . " WHERE id = '" . db_escape_string(drupal_truncate_bytes($metatag->path, 255)) . "'");
+      $sandbox['current_pid'] = $metatag->pid;
+      $sandbox['progress']++;
+    }
+  }
+
+  $ret['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
+
+  return $ret;
+}
+
+/**
+ * Implementation of hook_update_N().
+ */
+function nodewords_update_6162() {
+  $ret = array();
+
+  db_drop_index($ret, 'nodewords', 'nodewords_type_id');
+  db_drop_unique_key($ret, 'nodewords', 'nodewords_type_id_name');
+
+  db_change_field($ret, 'nodewords', 'type', 'type',
+    array(
+      'type' => 'int',
+      'size' => 'small',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+    )
+  );
+
+  db_change_field($ret, 'nodewords', 'id', 'id',
+    array(
+      'type' => 'int',
+      'size' => 'small',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+    )
+  );
+
+  db_add_index($ret, 'nodewords', 'nodewords_type_id',
+    array('type', 'id')
+  );
+  db_add_unique_key($ret, 'nodewords', 'nodewords_type_id_name',
+    array('type', 'id', 'name')
+  );
+
+  return $ret;
+}
+
+/**
  * Implementation of hook_uninstall().
  */
 function nodewords_uninstall() {
nodewords.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodewords/nodewords.module,v
retrieving revision 1.57.2.269
diff -u -p -r1.57.2.269 nodewords.module
--- nodewords.module	10 Dec 2009 21:58:27 -0000	1.57.2.269
+++ nodewords.module	14 Dec 2009 22:44:51 -0000
@@ -18,17 +18,17 @@
 /**
  * The type of objects to which the meta tags are associated.
  */
-define('NODEWORDS_TYPE_DEFAULT',    'default');
-define('NODEWORDS_TYPE_ERRORPAGE',  'errorpage');
-define('NODEWORDS_TYPE_FRONTPAGE',  'frontpage');
-define('NODEWORDS_TYPE_NODE',       'node');
-define('NODEWORDS_TYPE_NONE',       'none');
-define('NODEWORDS_TYPE_PAGE',       'page');
-define('NODEWORDS_TYPE_PAGER',      'pager');
-define('NODEWORDS_TYPE_TERM',       'term');
-define('NODEWORDS_TYPE_TRACKER',    'tracker');
-define('NODEWORDS_TYPE_USER',       'user');
-define('NODEWORDS_TYPE_VOCABULARY', 'vocabulary');
+define('NODEWORDS_TYPE_DEFAULT',    1);
+define('NODEWORDS_TYPE_ERRORPAGE',  2);
+define('NODEWORDS_TYPE_FRONTPAGE',  3);
+define('NODEWORDS_TYPE_NONE',       0);
+define('NODEWORDS_TYPE_NODE',       5);
+define('NODEWORDS_TYPE_PAGE',      10);
+define('NODEWORDS_TYPE_PAGER',      4);
+define('NODEWORDS_TYPE_TERM',       6);
+define('NODEWORDS_TYPE_TRACKER',    7);
+define('NODEWORDS_TYPE_USER',       8);
+define('NODEWORDS_TYPE_VOCABULARY', 9);
 
 /**
  * The types of meta tags the module is able to handle.
@@ -46,7 +46,7 @@ define('NODEWORDS_MINIMUM_API_VERSION', 
 /**
  * The current API version implemented.
  */
-define('NODEWORDS_API_VERSION', '1.7');
+define('NODEWORDS_API_VERSION', '1.8');
 
 /*****************************************************************************
  * Drupal hooks.
@@ -577,10 +577,10 @@ function nodewords_user_operations() {
  * Delete tags from table.
  */
 function nodewords_delete_tags($type, $id) {
-  db_query("DELETE FROM {nodewords} WHERE type = '%s' AND id = '%s'", $type, $id);
+  db_query("DELETE FROM {nodewords} WHERE type = %d AND id = %d", $type, $id);
 
   if ($type == NODEWORDS_TYPE_PAGE) {
-    db_query("DELETE FROM {nodewords_custom} WHERE path = '%s'", $id);
+    db_query("DELETE FROM {nodewords_custom} WHERE pid = %d", $id);
   }
 }
 
@@ -861,7 +861,7 @@ function nodewords_get_term($tid) {
  * Load tags from table.
  */
 function nodewords_load_tags($type = NODEWORDS_TYPE_DEFAULT, $id = '') {
-  $result = db_query("SELECT * FROM {nodewords} WHERE type = '%s' AND id = '%s'", $type, $id);
+  $result = db_query("SELECT * FROM {nodewords} WHERE type = %d AND id = %d", $type, $id);
   $tags = array();
   $tags_info = nodewords_get_possible_tags();
 
@@ -888,16 +888,10 @@ function nodewords_load_tags($type = NOD
  *  NODEWORDS_TYPE_PAGER, NODEWORDS_TYPE_PAGE, ...).
  */
 function nodewords_mass_delete_tags($ids, $type) {
-  db_query("DELETE FROM {nodewords} WHERE id IN (" . db_placeholders($ids, 'varchar') . ") AND type = '%s'",
+  db_query("DELETE FROM {nodewords} WHERE id IN (" . db_placeholders($ids, 'int') . ") AND type = %d",
     array_merge($ids, array($type))
   );
 
-  if ($type == NODEWORDS_TYPE_PAGE) {
-    db_query("DELETE FROM {nodewords_custom} WHERE path IN (" . db_placeholders($ids, 'varchar') . ")",
-      $ids
-    );
-  }
-
   drupal_set_message(t('The update has been performed.'));
 }
 
@@ -1080,7 +1074,7 @@ function nodewords_save_tags($type, $id,
   foreach ($tags as $name => $content) {
     if (isset($tags_info[$name])) {
       $content = serialize($content);
-      $result = db_fetch_object(db_query("SELECT * FROM {nodewords} WHERE type = '%s' AND id = '%s' AND name = '%s'", $type, $id, $name));
+      $result = db_fetch_object(db_query("SELECT * FROM {nodewords} WHERE type = %d AND id = %d AND name = '%s'", $type, $id, $name));
 
       if ($result === FALSE) {
         $row = new stdClass();
@@ -1196,7 +1190,7 @@ function _nodewords_detect_type_and_ids(
     );
 
     if ($bool) {
-      return array(NODEWORDS_TYPE_PAGE, $path);
+      return array(NODEWORDS_TYPE_PAGE, $page->pid);
     }
   }
 
