? trackhead.patch
Index: nutch.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nutch/nutch.admin.inc,v
retrieving revision 1.4
diff -w -u -p -r1.4 nutch.admin.inc
--- nutch.admin.inc	11 Nov 2010 17:58:41 -0000	1.4
+++ nutch.admin.inc	14 Nov 2010 10:23:05 -0000
@@ -6,7 +6,6 @@
  * Implements admin functionality relating to Nutch setup and running
  */
 
-
 /**
  * Settings form for Nutch setup
  * @TODO Need to add all of the extra crawl options 
@@ -16,9 +15,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',
@@ -82,6 +80,7 @@ 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_crawl_on_cron'] = array(
     '#type' => 'checkbox',
     '#title' => t('Run crawl on cron'),
@@ -92,9 +91,8 @@ function nutch_admin_settings() {
 }
 
 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',
@@ -140,6 +138,7 @@ function nutch_admin_crawl_submit($form,
            )
   );
 }
+
 /**
  * 
  * Runbot controller
@@ -211,10 +210,8 @@ function nutch_start_crawl($nutch_home, 
   else{
     $tmp = array();
     $process = proc_open($command . ' &', array(), $tmp);
-    drupal_set_message($process);
     $rtn = proc_close($process);
   }
-
 }
 
 function nutch_admin_seed() {
@@ -258,16 +255,15 @@ function nutch_admin_seed() {
   return system_settings_form($form);
 }
 
-
 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'));
 }
 
-
 function nutch_admin_logs() {
   $output = '';
   $log_file = variable_get('nutch_nutch_dir', '/usr/local/nutch') .'/logs/hadoop.log';
+  nutch_check_directory('logs', TRUE);
   if (!is_readable($log_file)) {
     drupal_set_message(t('Cannot access  %log either it does not exist or is not writable by the webserver.', array('%log' => $log_file)), 'error');
   }
@@ -294,3 +290,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: nutch.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nutch/nutch.module,v
retrieving revision 1.5
diff -w -u -p -r1.5 nutch.module
--- nutch.module	8 Nov 2010 22:37:40 -0000	1.5
+++ nutch.module	14 Nov 2010 10:23:05 -0000
@@ -31,7 +31,6 @@ function nutch_menu() {
       'page arguments'     => array('nutch_admin_settings'),
       'description'        => 'Nutch is a spidering software built on the lucene search engine',
       'access arguments'   => array('administer nutch'),
-//      'type'               => MENU_NORMAL_ITEM,
       'file'               => 'nutch.admin.inc',
     );
     $items['admin/settings/nutch/settings'] = array(
Index: runbot
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nutch/runbot,v
retrieving revision 1.3
diff -w -u -p -r1.3 runbot
