Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.722
diff -u -p -r1.722 system.module
--- modules/system/system.module	5 Jul 2009 18:00:10 -0000	1.722
+++ modules/system/system.module	10 Jul 2009 05:40:43 -0000
@@ -3039,3 +3039,17 @@ function system_retrieve_file($url, $des
   
   return $local;
 }
+
+/**
+ * Returns the document root of the Drupal installation, because
+ * $_SERVER['DOCUMENT_ROOT'] is not reliable on all environments
+ * like for instance Apache with mod_vhost.
+ *
+ * @return
+ *   The document root of the current installation.
+ */
+function system_path() {
+  $absolute_dir = dirname(__FILE__)
+  $relative_dir = drupal_get_path('module', 'system');
+  return substr($absolute_dir, 0, -1 * (1+strlen($relative_dir)));
+}
