Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.131
diff -u -r1.131 system.install
--- modules/system/system.install	11 Jul 2007 15:15:40 -0000	1.131
+++ modules/system/system.install	5 Aug 2007 16:33:50 -0000
@@ -3476,6 +3476,24 @@
 }
 
 /**
+ * Files directory now defaults to conf_path()/files so explicitly set
+ * file_directory_path to /files if files have aleady been uploaded to that
+ * directory.
+ */
+function system_update_6027() {
+  if (!variable_get('file_directory_path', '') && is_dir('files')) {
+    // File_directory_path has not been set and the files directory exists.
+    $count = db_result(db_query("SELECT COUNT(*) FROM {files} f WHERE f.filepath LIKE 'files/%%'"));
+    if ($count > 0) {
+      // At least one file has been uploaded to the files directory, so we need
+      // to explicitly set the variable now that the default has changed.
+      variable_set('file_directory_path', 'files');
+    }
+  }
+  return array();
+}
+
+/**
  * @} End of "defgroup updates-5.x-to-6.x"
  * The next series of updates should start at 7000.
  */
