Index: nutch.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nutch/nutch.admin.inc,v
retrieving revision 1.2
diff -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 13:36:17 -0000
@@ -46,7 +46,7 @@ function nutch_admin_settings() {
     $host = variable_get('apachesolr_host', 'localhost');
     $port = variable_get('apachesolr_port', '8983');
     $path = variable_get('apachesolr_path', '/solr');
-    $nutch_solr = sprintf('http://%s:%s%s',$host, $port, $path);
+    $nutch_solr = sprintf('http://%s:%s%s', $host, $port, $path);
   }
   $form['system']['nutch_solr'] = array(
     '#type' => 'textfield',
@@ -59,14 +59,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 +82,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,7 +89,6 @@ function nutch_admin_settings() {
     '#default_value' => variable_get('nutch_crawl_on_cron', 0),
   );
 
-
   return system_settings_form($form);
 }
 
@@ -128,23 +122,27 @@ 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
   );
 }
 
 function nutch_start_crawl($nutch_home, $java_home, $solr_url, $commit=0, $fetch_amount=100, $seed_urls='', $debug=0) {
   
-  $command =  $_SERVER['DOCUMENT_ROOT'] . base_path() . drupal_get_path('module', 'nutch') .'/'.'runbot';
+  $command =  $_SERVER['DOCUMENT_ROOT'] . base_path() . drupal_get_path('module', 'nutch') . '/' . 'runbot';
 
   if (!empty($nutch_home)){
-    $command .= ' -n '. escapeshellarg($nutch_home);
+    $command .= ' -n ' . escapeshellarg($nutch_home);
   }
   else {
     drupal_set_message(t("You must supply a nutch home directory; crawl aborted."));
@@ -152,7 +150,7 @@ function nutch_start_crawl($nutch_home, 
   }
   
   if (!empty($java_home)) {
-    $command .= ' -j '. escapeshellarg($java_home);
+    $command .= ' -j ' . escapeshellarg($java_home);
   }
   else {
     drupal_set_message(t("You must supply a java home; crawl aborted."));
@@ -160,7 +158,7 @@ function nutch_start_crawl($nutch_home, 
   }  
 
   if (!empty($solr_url)) {
-    $command .= ' -s '. escapeshellarg($solr_url);
+    $command .= ' -s ' . escapeshellarg($solr_url);
   }
   else {
     drupal_set_message(t("You must the url path to your Solr instance; crawl aborted."));
@@ -176,12 +174,12 @@ function nutch_start_crawl($nutch_home, 
      */
     $seed_urls_replaced = str_replace("\n", '!', $seed_urls);
     if($debug == 1) drupal_set_message($seed_urls_replaced);
-    $command .= ' -u '. escapeshellarg($seed_urls_replaced);
+    $command .= ' -u ' . escapeshellarg($seed_urls_replaced);
   }
   
-  $command .= ' -c '. escapeshellarg($commit);
-  $command .= ' -f '. escapeshellarg($fetch_amount);
-  $command .= ' -d '. escapeshellarg($debug);
+  $command .= ' -c ' . escapeshellarg($commit);
+  $command .= ' -f ' . escapeshellarg($fetch_amount);
+  $command .= ' -d ' . escapeshellarg($debug);
   
   drupal_set_message(t("Starting Nutch Crawl."));
   if($debug == 1){
@@ -193,7 +191,7 @@ function nutch_start_crawl($nutch_home, 
     }
     drupal_set_message($rtn_output);     
   }
-  else{
+  else {
     $tmp = array();
     $process = proc_open($command . ' &', array(), $tmp);
     drupal_set_message($process);
@@ -245,8 +243,8 @@ function nutch_admin_seed() {
 
 
 function nutch_admin_inject_submit($form, &$form_state) {
-    drupal_set_message(t("Nutch is injecting URLs."));
-    nutch_do_inject(variable_get('nutch_nutch_dir', '/usr/local/nutch'), variable_get('nutch_crawl_dir', '/usr/local/nutch/crawl'), variable_get('nutch_urls_dir', '/usr/local/nutch/seed'));
+  drupal_set_message(t("Nutch is injecting URLs."));
+  nutch_do_inject(variable_get('nutch_nutch_dir', '/usr/local/nutch'), variable_get('nutch_crawl_dir', '/usr/local/nutch/crawl'), variable_get('nutch_urls_dir', '/usr/local/nutch/seed'));
 }
 
 
Index: runbot
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nutch/runbot,v
retrieving revision 1.2
diff -u -p -r1.2 runbot
--- runbot	22 Oct 2010 16:23:49 -0000	1.2
+++ runbot	8 Nov 2010 13:36:17 -0000
@@ -62,6 +62,7 @@ then
   echo "Solr URL: $s"
   echo "Seed URL: $u"
   echo "Debug: $d"
+  echo "Running as: `whoami`"
   
 fi
 
