Index: /Users/Kiam/Sandbox/6.1-dev/contributions/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module,v
retrieving revision 1.19.2.115
diff -u -p -r1.19.2.115 xmlsitemap_node.module
--- xmlsitemap_node.module	7 May 2009 20:14:37 -0000	1.19.2.115
+++ xmlsitemap_node.module	7 May 2009 20:54:53 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: xmlsitemap_node.module,v 1.19.2.115 2009/05/07 20:14:37 kiam Exp $
+// $Id: xmlsitemap_node.module,v 1.19.2.114 2009/05/07 13:39:18 kiam Exp $
 
 /**
  * @file
@@ -16,50 +16,6 @@
  ****************************************************************************/
 
 /**
- * Implementation of hook_comment().
- */
-function xmlsitemap_node_comment($a1, $op) {
-  switch ($op) {
-    case 'insert':
-    case 'update':
-    case 'delete':
-    case 'publish':
-    case 'unpublish':
-      $maxcomments = (integer) db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'));
-      if ($nid = is_array($a1) ? $a1['nid'] : $a1->nid) {
-        if (!($node = node_load($nid))) {
-          return;
-        }
-        $comments = (integer) db_result(db_query('SELECT comment_count
-          FROM {node_comment_statistics}
-          WHERE nid = %d', $nid)
-        );
-        $query = "SELECT nid, changed, previously_changed, comment_ratio, priority_override
-          FROM {xmlsitemap_node}
-          WHERE nid = %d";
-        if (($link = db_fetch_object(db_query($query, $nid))) !== FALSE) {
-          $row = $link;
-          if ($node->changed > $row->changed) {
-            $row->previously_changed = $row->changed;
-            $row->changed = $node->changed;
-          }
-        }
-        else {
-          $row = new stdClass();
-          $row->nid = $nid;
-          $row->changed = $node->changed;
-          $row->previously_changed = $node->created;
-        }
-        if ($maxcomments > 1) {
-          $row->comment_ratio = $comments / $maxcomments;
-        }
-        drupal_write_record('xmlsitemap_node', $row, ($link !== FALSE) ? 'nid' : NULL);
-      }
-      break;
-  }
-}
-
-/**
  * Implementation of hook_cron().
  */
 function xmlsitemap_node_cron() {
@@ -70,23 +26,10 @@ function xmlsitemap_node_cron() {
         AND n.status <> 0";
     $result = db_query_range($sql, 0, $limit);
     while ($node = db_fetch_object($result)) {
-      if (module_exists('comment')) {
-        $maxcomments = (integer) db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'));
-        $comments = (integer) db_result(db_query('SELECT comment_count
-          FROM {node_comment_statistics}
-          WHERE nid = %d', $node->nid)
-        );
-      }
-      else {
-        $maxcomments = 0;
-      }
       $row = new stdClass();
       $row->nid = $node->nid;
       $row->changed = $node->changed;
       $row->previously_changed = $node->created;
-      if ($maxcomments > 1) {
-        $row->comment_ratio = $comments / $maxcomments;
-      }
       drupal_write_record('xmlsitemap_node', $row);
     }
   }
@@ -148,7 +91,6 @@ function xmlsitemap_node_form_node_type_
  * Implementation of hook_form_FORM_ID_alter().
  */
 function xmlsitemap_node_form_xmlsitemap_settings_alter(&$form, &$from_state) {
-  $options = xmlsitemap_priority_options();
   $form['xmlsitemap_node'] = array(
     '#type' => 'fieldset',
     '#title' => t('Node settings'),
@@ -161,42 +103,11 @@ function xmlsitemap_node_form_xmlsitemap
     '#title' => t('Promotion priority adjustment'),
     '#description' => t("This number will be added to the priority of each post that is promoted to the front page. This setting doesn't apply for the nodes for which the priority is overriden."),
     '#default_value' => variable_get('xmlsitemap_node_promote_priority', 0.3),
-    '#options' => $options,
-  );
-  $form['xmlsitemap_node']['xmlsitemap_node_comment_priority'] = array(
-    '#type' => 'select',
-    '#title' => t('Comment ratio priority adjustment'),
-    '#description' => t("This number will be added to the priority of the post with the highest number of comments; for the other posts, the number is calculated proportionally to the number of comments. This doesn't apply if the maximum number of comments is one, nor for the nodes for which the priority is overriden."),
-    '#default_value' => variable_get('xmlsitemap_node_comment_priority', 0.2),
-    '#options' => $options,
+    '#options' => xmlsitemap_priority_options(),
   );
 }
 
 /**
- * Implementation of hook_node_operations().
- */
-function xmlsitemap_node_node_operations() {
-  $operations = array(
-    'xmlsitemap_add_nodes' => array(
-      'label' => t('Add the selected posts to the XML sitemap'),
-      'callback' => '_xmlsitemap_node_priority_operations',
-      'callback arguments' => array('priority' => 0.5),
-    ),
-    'xmlsitemap_change_nodes_priority' => array(
-      'label' => t('Change the XML sitemap priority of the selected posts to default'),
-      'callback' => '_xmlsitemap_node_priority_operations',
-      'callback arguments' => array('priority' => -2.0),
-    ),
-    'xmlsitemap_remove_nodes' => array(
-      'label' => t('Remove the selected posts from the XML sitemap'),
-      'callback' => '_xmlsitemap_node_priority_operations',
-      'callback arguments' => array('priority' => -1.0),
-    ),
-  );
-  return $operations;
-}
-
-/**
  * Implementation of hook_node_type().
  */
 function xmlsitemap_node_node_type($op, $info) {
@@ -341,7 +252,7 @@ function xmlsitemap_node_type_submit($fo
  * @see xmlsitemap_node_set_priority()
  */
 function xmlsitemap_node_get_priority($node, $load = FALSE) {
-  if (!isset($node->priority_override) && $load) {
+  if (!isset($node->priority_override) && $reload) {
     $priority_override = db_result(db_query("SELECT xn.priority_override FROM {xmlsitemap_node} xn ON WHERE xn.nid = %d", $node->nid));
     if ($priority_override !== FALSE) {
       $node->priority_override = $priority_override;
@@ -405,60 +316,6 @@ function xmlsitemap_node_set_priority($n
   return FALSE;
 }
 
-/*****************************************************************************
- * Private functions - node operation callbacks.
- ****************************************************************************/
-
-/**
- * Node operations callback.
- */
-function _xmlsitemap_node_priority_operations($nodes, $priority) {
-  if (count($nodes)) {
-    $batch = array(
-      'operations' => array(
-        array('_xmlsitemap_node_batch_process', array($nodes, $priority))
-      ),
-      'finished' => 'xmlsitemap_batch_operations_finished',
-      'title' => t('Processing'),
-      'progress_message' => '',
-      'error_message' => t('The update has encountered an error.'),
-    );
-    batch_set($batch);
-  }
-}
-
-/*****************************************************************************
- * Private functions - batch operation callbacks.
- ****************************************************************************/
-
-/**
- * Node operations batch process callback.
- */
-function _xmlsitemap_node_batch_process($nodes, $priority, &$context) {
-  if (!isset($context['sandbox']['progress'])) {
-    $context['sandbox']['progress'] = 0;
-    $context['sandbox']['max'] = count($nodes);
-    $context['sandbox']['nodes'] = $nodes;
-    if (module_exists('comment')) {
-      $context['sandbox']['maxcomments'] = (integer) db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'));
-    }
-  }
-  $nid = array_shift($context['sandbox']['nodes']);
-  if ($node = xmlsitemap_node_set_priority($nid, $priority)) {
-    $context['results'][] = l($node->title, 'node/'. $nid);
-    if (count($context['results']) > 6) {
-      array_shift($context['results']);
-    }
-  }
-  $context['sandbox']['progress']++;
-  if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
-  }
-  else {
-    xmlsitemap_flag_sitemap();
-  }
-}
-
 /**
  * @} End of "addtogroup xmlsitemap".
  */
