From 3c975f4bb8d3975dc73444e47d01dd98e9b2b37a Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Tue, 8 Aug 2006 21:18:04 +0000
Subject: [PATCH] - Patch #77549 by adrian: install profiles should be in their
 own directory.

---
 includes/install.inc                   | 4 ++--
 install.php                            | 5 +++--
 modules/system/system.module           | 6 ++++++
 profiles/{ => default}/default.profile | 0
 4 files changed, 11 insertions(+), 4 deletions(-)
 rename profiles/{ => default}/default.profile (100%)

diff --git a/includes/install.inc b/includes/install.inc
index 12f9560fd40f..77dd88d54aa6 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -259,7 +259,7 @@ function drupal_get_install_files($module_list = array()) {
 function drupal_verify_profile($profile) {
   include_once './includes/file.inc';
 
-  $profile_file = "./profiles/$profile.profile";
+  $profile_file = "./profiles/$profile/$profile.profile";
 
   if (!isset($profile) || !file_exists($profile_file)) {
     _install_no_profile_error();
@@ -551,4 +551,4 @@ function install_goto($path) {
 function st($string, $args = array()) {
   require_once './includes/theme.inc';
   return strtr($string, array_map('theme_placeholder', $args));
-}
\ No newline at end of file
+}
diff --git a/install.php b/install.php
index ed1636af6742..cff4a0ae13df 100644
--- a/install.php
+++ b/install.php
@@ -54,7 +54,7 @@ function install_main() {
     _install_no_profile_error();
   }
   // Load the profile.
-  require_once "./profiles/$profile.profile";
+  require_once "./profiles/$profile/$profile.profile";
 
   // Change the settings.php information if verification failed earlier.
   if (!$verify) {
@@ -414,6 +414,8 @@ function install_already_done_error() {
  */
 function install_complete($profile) {
   global $base_url;
+  // Store install profile for later use.
+  variable_set('install_profile', $profile);
 
   // Bootstrap newly installed Drupal, while preserving existing messages.
   $messages = $_SESSION['messages'];
@@ -436,7 +438,6 @@ function install_complete($profile) {
     $msg = drupal_set_message() ? 'Please review the messages above before continuing on to <a href="%url">your new site</a>.' : 'You may now visit <a href="%url">your new site</a>.';
     $output .= strtr('<p>'. $msg .'</p>', array('%url' => url('')));
   }
-
   // Output page.
   print theme('maintenance_page', $output);
 }
diff --git a/modules/system/system.module b/modules/system/system.module
index 5aaf97a634b6..89d6a7bef01b 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -954,11 +954,17 @@ function system_default_region($theme) {
  */
 function system_listing($mask, $directory, $key = 'name', $min_depth = 1) {
   $config = conf_path();
+  $profile = variable_get('install_profile', 'default');
   $searchdir = array($directory);
   $files = array();
 
   // Always search sites/all/* as well as the global directories
   $searchdir[] = 'sites/all';
+
+  if (file_exists("profiles/$profile/$directory")) {
+    $searchdir[] = "profiles/$profile/$directory";
+  }
+
   if (file_exists("$config/$directory")) {
     $searchdir[] = "$config/$directory";
   }
diff --git a/profiles/default.profile b/profiles/default/default.profile
similarity index 100%
rename from profiles/default.profile
rename to profiles/default/default.profile
-- 
GitLab