Index: nutch.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nutch/nutch.admin.inc,v
retrieving revision 1.2
diff -w -u -p -r1.2 nutch.admin.inc
--- nutch.admin.inc	27 Oct 2010 11:12:33 -0000	1.2
+++ nutch.admin.inc	8 Nov 2010 19:17:15 -0000
@@ -16,9 +16,8 @@
  *        - adddays
  */
 function nutch_admin_settings() {
-  if(!file_check_directory(variable_get('nutch_nutch_dir', '/usr/local/nutch'))){
-    drupal_set_message(t('The Directory %directory either does not exist or is not writable by the webserver.', array('%directory' => variable_get('nutch_nutch_dir', '/usr/local/nutch'))), 'error');
-  }
+  nutch_check_directory('logs');
+
   $form = array();
   $form['system'] = array(
     '#type' => 'fieldset',
@@ -59,14 +58,14 @@ function nutch_admin_settings() {
     '#type' => 'select',
     '#title' => t('Per host URL fetch limit'),
     '#options' => drupal_map_assoc(array(1, 2, 5, 10)),
-    '#default_value' => variable_get('nutch_urls_to_fetch', 2),
-    '#description' => t('The depth to follow a links on a page'),
+    '#default_value' => variable_get('nutch_crawl_depth', 2),
+    '#description' => t('The depth to follow links on a page'),
   );
   $form['system']['nutch_topN'] = array(
     '#type' => 'select',
     '#title' => t('Top URLs by Score'),
     '#options' => drupal_map_assoc(array(1, 5, 10, 20, 50, 100)),
-    '#default_value' => variable_get('nutch_urls_to_fetch', 100),
+    '#default_value' => variable_get('nutch_topN', 100),
     '#description' => t('Grab the top N URLs based on nutch Score.'),
   );   
   $form['system']['nutch_urls_to_fetch'] = array(
@@ -82,11 +81,6 @@ function nutch_admin_settings() {
     '#description' => t('Send to Solr at the end of the Nutch crawl'),
     '#default_value' => variable_get('nutch_commit', 1),
   );    
-  $form['system']['nutch_debug'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Dry run/debug crawl'),
-    '#default_value' => variable_get('nutch_debug', 0),
-  );    
 
   $form['system']['nutch_crawl_on_cron'] = array(
     '#type' => 'checkbox',
@@ -94,14 +88,12 @@ function nutch_admin_settings() {
     '#default_value' => variable_get('nutch_crawl_on_cron', 0),
   );
 
-
   return system_settings_form($form);
 }
 
 function nutch_admin_crawl() {
-  if(!file_check_directory(variable_get('nutch_nutch_dir', '/usr/local/nutch'))){
-    drupal_set_message(t('The Directory %directory either does not exist or is not writable by the webserver.', array('%directory' => variable_get('nutch_nutch_dir', '/usr/local/nutch'))), 'error');
-  }  
+  nutch_check_directory('logs', TRUE);
+
   $form = array();
   $form['controls'] = array(
     '#type' => 'fieldset',
@@ -128,14 +120,18 @@ function nutch_admin_crawl() {
 }
 
 function nutch_admin_crawl_submit($form, &$form_state) {
+  $nutch_commit = (int) $form_state['values']['nutch_commit'];
+  $nutch_debug = (int) $form_state['values']['nutch_debug'];
+  variable_set('nutch_commit', $nutch_commit);
+  variable_set('nutch_debug', $nutch_debug);
   nutch_start_crawl(
            variable_get('nutch_nutch_dir', '/usr/local/nutch'), 
            variable_get('nutch_java', '/usr'), 
            variable_get('nutch_solr', FALSE), 
-           (@$form['#post']['nutch_commit']?$form['#post']['nutch_commit']:variable_get('nutch_commit', 1)), 
+           $nutch_commit, 
            variable_get('nutch_urls_to_fetch', 100), 
            variable_get('nutch_seed_url', 'http://localhost'), 
-           (@$form['#post']['nutch_debug']?$form['#post']['nutch_debug']:variable_get('nutch_debug', 0))
+           $nutch_debug
   );
 }
 
@@ -279,3 +275,19 @@ function nutch_get_current_seed_urls(){
   }
   return $output;
 }
+
+function nutch_check_directory($directory, $show_form_errors = FALSE) {
+  $directory = variable_get('nutch_nutch_dir', '/usr/local/nutch') . "/$directory";
+  $success = FALSE;
+  if ($show_form_errors) {
+    $success = file_check_directory($directory, TRUE, 'nutch_check_directory');
+  }
+  else {
+    $success = file_check_directory($directory, TRUE);
+  }
+  if (!$success) {
+    $help = t("Make sure that %directory is executable and writable by the webserver user (usually <em>www-data</em> or <em>nobody</em>). The parent directories may need these permissions too.", array('%directory' => $directory));
+    drupal_set_message($help, 'warning');
+  }  
+}
+
Index: runbot
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nutch/runbot,v
retrieving revision 1.2
diff -w -u -p -r1.2 runbot
--- runbot	22 Oct 2010 16:23:49 -0000	1.2
+++ runbot	8 Nov 2010 19:17:15 -0000
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Runs the Nutch bot to crawl or re-crawl
 # Usage: bin/runbot [safe]
@@ -62,6 +62,7 @@ then
   echo "Solr URL: $s"
   echo "Seed URL: $u"
   echo "Debug: $d"
+  echo "Running as: `whoami`"
   
 fi
 
