? boost-482000.patch
Index: boost.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.admin.inc,v
retrieving revision 1.1.2.1.2.3.2.40
diff -u -p -r1.1.2.1.2.3.2.40 boost.admin.inc
--- boost.admin.inc	22 Jul 2009 02:59:40 -0000	1.1.2.1.2.3.2.40
+++ boost.admin.inc	22 Jul 2009 21:08:45 -0000
@@ -138,6 +138,8 @@ function boost_admin_clear_cache_submit(
  *  http://drupal.org/node/337756
  */
 function boost_admin_boost_performace_page() {
+  Global $base_path;
+
   // Cacheability settings
   $options = array(t('Cache every page except the listed pages.'), t('Cache only the listed pages.'));
   $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '%blog' for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
@@ -301,12 +303,35 @@ function boost_admin_boost_performace_pa
     '#options'       => array('%{SERVER_NAME}' => '%{SERVER_NAME}', '%{HTTP_HOST}' => '%{HTTP_HOST}', $_SERVER['SERVER_NAME'] => $_SERVER['SERVER_NAME'], $_SERVER['HTTP_HOST'] => $_SERVER['HTTP_HOST'], ),
     '#description'   => t('Best to leave these as %{}, only try the last option(s) if boost is still not working.'),
   );
+
+  $drupal_subdir = rtrim($base_path, '/');
+  $document_root = str_replace("\\", '/', getcwd());
+  $document_root = str_replace($drupal_subdir, '', $document_root);
+  $options = array('%{DOCUMENT_ROOT}' => '%{DOCUMENT_ROOT}', $document_root => $document_root);
+  if (isset($_SERVER['PHP_DOCUMENT_ROOT'])) {
+    $options = array_merge(array('%{PHP_DOCUMENT_ROOT}' => '%{PHP_DOCUMENT_ROOT}'), $options);
+    if ($_SERVER['PHP_DOCUMENT_ROOT'] == $document_root) {
+      $best = '%{PHP_DOCUMENT_ROOT}';
+    }
+  }
+  if ($_SERVER['DOCUMENT_ROOT'] == $document_root) {
+    $best = '%{DOCUMENT_ROOT}';
+  }
+  else {
+    $best = $document_root;
+
+  }
+  $description = t("Value of $best is recommened for this server.");
+  if ($best == $document_root) {
+    $description .= t(' Please open an boost issue on drupal.org, since apache and php are not configured correctly.');
+  }
+
   $form['htaccess']['boost_document_root'] = array(
     '#type'          => 'radios',
     '#title'         => t('Document Root'),
     '#default_value' => variable_get('boost_document_root', '%{DOCUMENT_ROOT}'),
-    '#options'       => array('%{DOCUMENT_ROOT}' => '%{DOCUMENT_ROOT}', getcwd() => getcwd()),
-    '#description'   => t('Default value %{DOCUMENT_ROOT} is highly recommened.'),
+    '#options'       => $options,
+    '#description'   => $description,
   );
   $form['htaccess']['boost_generated'] = array(
     '#type'          => 'textarea',
@@ -399,8 +424,6 @@ function boost_admin_themes_submit($form
 function boost_admin_generate_htaccess($server_name = '%{SERVER_NAME}', $document_root = '%{DOCUMENT_ROOT}', $cache_dir = 'cache', $gzip_dir = 'gz', $html = '.html', $xml = '.xml') {
   Global $base_path;
   $drupal_subdir = rtrim($base_path, '/');
-  $document_root = str_replace("\\", '/', $document_root);
-  $document_root = str_replace($drupal_subdir, '', $document_root );
   $html = '\\' . $html;
   $xml = '\\' . $xml;
   $css = '\\.css';
