Index: configdoc.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/configdoc/configdoc.module,v
retrieving revision 1.4
diff -u -r1.4 configdoc.module
--- configdoc.module	5 Jun 2009 06:02:19 -0000	1.4
+++ configdoc.module	17 Sep 2009 16:17:30 -0000
@@ -16,60 +16,74 @@
     'access arguments' => array('access administration pages'),
     'weight' => 10,
     );
+
+  $items['admin/settings/configdoc'] = array(
+    'title' => 'Configuration State',
+    'description' => 'Configure Configdoc',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('configdoc_settings'),
+    'access arguments' => array('access administration pages'),
+    );
+
   return $items;
 }
 
 function configdoc_settings($form_state) {
   $form = array();
-  
+
   $form['configdoc_show'] = array(
     '#type' => 'radios',
     '#options' => array('enabled' => t('Enabled only'), 'disabled' => t('Both enabled and disabled')),
     '#title' => t('Which modules to show'),
     '#default_value' => variable_get('configdoc_show', 'disabled'),
     );
-  
+
   return system_settings_form($form);
 }
 
 function configdoc_page($form_state) {
-  
-  $configdoc_output = configdoc_create();
+  $report = cache_get('configdoc_report');
+  if ($configdoc_output = cache_get('configdoc_report')) {
+    $configdoc_output = $report->data;    
+  }
+  else {
+    $configdoc_output = configdoc_create();
+    cache_set('configdoc_report', $configdoc_output);
+  }
   $form = array();
-  
+
+  //$form['#action'] = base_path().'admin/reports/configdoc/save';
   $form['body'] = array(
     '#type' => 'textarea',
     '#title' => t('Report'),
     '#default_value' => $configdoc_output,
     '#rows' => 30,
-    '#cols' => 80,
+//    '#cols' => 80,
+    '#description' => t('If you are copying and pasting this into another site, you may wish to include a preformatted tag (&lt;pre&gt;&lt;/pre&gt;).'),
     );
-  
+
   $form['save'] = array(
     '#type' => 'submit',
     '#submit' => array('configdoc_save'),
     '#value' => t('Save as'),
     );
-  
+
   return $form;
 }
 
 function configdoc_save($form, &$form_state) {
-  
   $report = $form_state['values']['body'];
   header('Content-Type: text/txt');
   header('Content-Disposition: attachment; filename="configdoc.txt"');
   echo $report;
   exit();
-  
 }
 
-function configdoc_create( ) {
+function configdoc_create() {
   global $db_type;
   $output = array();
-  
   $show = variable_get('configdoc_show', 'disabled');
-  
+
   update_refresh();
   if ($available=update_get_available(TRUE)) {
     $files = module_rebuild_cache();
@@ -84,25 +98,26 @@
       }
       $packages[$module->info['package']][$module->name] = (array) $module;
     }
-    
+
     unset($files);
     ksort($packages);
-    
+
     $data = update_calculate_project_data($available);
-    
+
     $output[] = 'DRUPAL CORE';
-    
+
     $output[] = ' Version: '. VERSION;
     $output[] = ' Recommended version: '. $data['drupal']['recommended'];
+
     $output[] = '';
     $output[] = 'PHP VERSION: '. phpversion();
-    
+
     $output[] = '';
     $output[] = 'DATABASE TYPE: '. $db_type .'; VERSION: '. db_version();
+
     $output[] = '';
     $output[] = 'DRUPAL MODULES';
     $i = 0;
-    
     foreach ($packages as $p_key => $modules) {
       $output[] = '  Package: '. $p_key;
       foreach ($modules as $key => $module) {
@@ -127,17 +142,18 @@
           $extra[] = 'Minimum PHP version required: '. $module['info']['php'];
         }
         $output[] = '    Module: '. $module['info']['name']
-        . ($extra ? ('  ('. implode('; ', $extra) .')') : NULL);
+          . ($extra ? ('  ('. implode('; ', $extra) .')') : NULL);
       }
     }
     unset($data);
   }
-  
+
   $output[] = '';
   $output[] = 'WEB SERVER: '. $_SERVER['SERVER_SOFTWARE'];
   $output[] = '';
   $output[] = 'DRUPAL MINIMUM SUPPORTED PHP VERSION: '. DRUPAL_MINIMUM_PHP;
   $output[] = '';
+
   $exts = get_loaded_extensions();
   if ($exts) {
     $output[] = '';
@@ -146,6 +162,7 @@
       $output[] = '  '. $ext;
     }
   }
+
   if (stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== FALSE && in_array('apache2handler', $exts)) {
     $mods = apache_get_modules();
     $output[] = '';
@@ -153,16 +170,16 @@
     foreach ($mods as $mod)
       $output[] = '  '. $mod;
   }
-  
+
   $output[] = '';
   $output[] = 'USER BROWSER: '. $_SERVER['HTTP_USER_AGENT'];
   $output[] = '';
   $output[] = 'CLEAN URLS: '. (variable_get('clean_url', 0) ? "enabled" : "disabled");
+
   $output[] = '';
-  
   $output[] = t('CRON LAST RUN: @time ago', array('@time' => format_interval(time() - variable_get('cron_last', 0))));
   //$output[] = "";
   //$output[] = t('Last checked: @time ago', array('@time' => format_interval(time() - variable_get('update_last_check', 0))));
-  
+
   return count($output) ? implode("\r\n", $output) : 'Report error';
 }

