diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index a5d2bc9..b35ef11 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -835,8 +835,11 @@ function drupal_get_filename($type, $name, $filename = NULL) { // Profiles are a special case: they have a fixed location and naming. if ($type == 'profile') { - $profile_filename = "profiles/$name/$name.profile"; - $files[$type][$name] = file_exists($profile_filename) ? $profile_filename : FALSE; + // Profiles are found via the install_find_profiles() function. + require_once DRUPAL_ROOT . '/core/includes/install.core.inc'; + foreach (install_find_profiles() as $profile_name => $profile) { + $files[$type][$profile_name] = file_exists($profile->uri) ? $profile->uri : FALSE; + } } if (!isset($files[$type])) { $files[$type] = array(); diff --git a/core/includes/common.inc b/core/includes/common.inc index 23069cb..8cd9f24 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -5367,8 +5367,11 @@ function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1) // profile always has precedence. $profiles[] = $profile; foreach ($profiles as $profile) { - if (file_exists("profiles/$profile/$directory")) { - $searchdir[] = "profiles/$profile/$directory"; + if (file_exists("core/profiles/$profile/$directory")) { + $searchdir[] = "core/profiles/$profile/$directory"; + } + if (file_exists("sites/all/profiles/$profile/$directory")) { + $searchdir[] = "sites/all/profiles/$profile/$directory"; } } diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index eb9dff9..97ec287 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -622,7 +622,8 @@ function install_tasks($install_state) { if (!empty($install_state['parameters']['profile'])) { // Load the profile install file, because it is not always loaded when // hook_install_tasks() is invoked (e.g. batch processing). - $profile_install_file = DRUPAL_ROOT . '/profiles/' . $install_state['parameters']['profile'] . '/' . $install_state['parameters']['profile'] . '.install'; + $profile = $install_state['parameters']['profile']; + $profile_install_file = dirname($install_state['profiles'][$profile]->uri) . '/' . $profile . '.install'; if (file_exists($profile_install_file)) { include_once $profile_install_file; } @@ -650,7 +651,8 @@ function install_tasks($install_state) { // Allow the installation profile to modify the full list of tasks. if (!empty($install_state['parameters']['profile'])) { - $profile_file = DRUPAL_ROOT . '/profiles/' . $install_state['parameters']['profile'] . '/' . $install_state['parameters']['profile'] . '.profile'; + $profile = $install_state['parameters']['profile']; + $profile_file = $install_state['profiles'][$profile]->uri; if (file_exists($profile_file)) { include_once $profile_file; $function = $install_state['parameters']['profile'] . '_install_tasks_alter'; @@ -1097,7 +1099,12 @@ function install_settings_form_submit($form, &$form_state) { * Finds all .profile files. */ function install_find_profiles() { - return file_scan_directory('./profiles', '/\.profile$/', array('key' => 'name')); + // Statically cache the profile URI locations. + $profiles = &drupal_static(__FUNCTION__); + if (!isset($profiles)) { + $profiles = drupal_system_listing('/\.profile$/', 'profiles'); + } + return $profiles; } /** @@ -1428,7 +1435,8 @@ function install_already_done_error() { * the profile cannot be loaded. */ function install_load_profile(&$install_state) { - $profile_file = DRUPAL_ROOT . '/profiles/' . $install_state['parameters']['profile'] . '/' . $install_state['parameters']['profile'] . '.profile'; + $profile = $install_state['parameters']['profile']; + $profile_file = $install_state['profiles'][$profile]->uri; if (file_exists($profile_file)) { include_once $profile_file; $install_state['profile_info'] = install_profile_info($install_state['parameters']['profile'], $install_state['parameters']['langcode']); @@ -1679,7 +1687,7 @@ function install_check_requirements($install_state) { $profile = $install_state['parameters']['profile']; // Check the profile requirements. - $requirements = drupal_check_profile($profile); + $requirements = drupal_check_profile($profile, $install_state); // If Drupal is not set up already, we need to create a settings file. if (!$install_state['settings_verified']) { diff --git a/core/includes/install.inc b/core/includes/install.inc index cd67257..79d7436 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -262,7 +262,7 @@ function drupal_verify_profile($install_state) { include_once DRUPAL_ROOT . '/core/includes/file.inc'; include_once DRUPAL_ROOT . '/core/includes/common.inc'; - $profile_file = DRUPAL_ROOT . "/profiles/$profile/$profile.profile"; + $profile_file = $install_state['profiles'][$profile]->uri; if (!isset($profile) || !file_exists($profile_file)) { throw new Exception(install_no_profile_error()); @@ -746,13 +746,17 @@ function st($string, array $args = array(), array $options = array()) { * * @param $profile * Name of install profile to check. + * @param $install_state + * The current state in the install process. * @return * Array of the install profile's requirements. */ -function drupal_check_profile($profile) { +function drupal_check_profile($profile, $install_state = array()) { include_once DRUPAL_ROOT . '/core/includes/file.inc'; - $profile_file = DRUPAL_ROOT . "/profiles/$profile/$profile.profile"; + // Retrieve the profile file. If the install state is available, then use the + // the information from that. + $profile_file = isset($install_state['profiles'][$profile]->uri) ? $install_state['profiles'][$profile]->uri : DRUPAL_ROOT . "/core/profiles/$profile/$profile.profile"; if (!isset($profile) || !file_exists($profile_file)) { throw new Exception(install_no_profile_error()); @@ -850,8 +854,10 @@ function drupal_check_module($module) { * * @param $profile * Name of profile. - * @param $langcode - * Language code (if any). + * @param $options + * An associative array of values to override in the profile. + * - langcode: Language code (if any). + * - uri: The URI location for the profile file. * * @return * The info array. @@ -869,7 +875,10 @@ function install_profile_info($profile, $langcode = 'en') { 'hidden' => FALSE, 'php' => DRUPAL_MINIMUM_PHP, ); - $info = drupal_parse_info_file("profiles/$profile/$profile.info") + $defaults; + + // Find the location of the file and construct the info from it. + $profiles = install_find_profiles(); + $info = drupal_parse_info_file($profiles[$profile]->uri) + $defaults; $info['dependencies'] = array_unique(array_merge( drupal_required_modules(), $info['dependencies'], diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php index c9baa83..f707a02 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php @@ -41,7 +41,7 @@ class GetFilenameUnitTest extends UnitTestBase { // Retrieving the location of a profile. Profiles are a special case with // a fixed location and naming. - $this->assertIdentical(drupal_get_filename('profile', 'standard'), 'profiles/standard/standard.profile', t('Retrieve install profile location.')); + $this->assertIdentical(drupal_get_filename('profile', 'standard'), 'core/profiles/standard/standard.profile', t('Retrieve install profile location.')); // When a file is not found in the database cache, drupal_get_filename() // searches several locations on the filesystem, including the core/ diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/SystemListingTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/SystemListingTest.php index 48ef555..ad4266c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/SystemListingTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/SystemListingTest.php @@ -33,12 +33,12 @@ class SystemListingTest extends WebTestBase { // precedence. 'drupal_system_listing_incompatible_test' => array( 'core/modules/system/tests/modules', - 'profiles/testing/modules', + 'core/profiles/testing/modules', ), // When both copies of the module are compatible with Drupal core, the // copy in the profile directory takes precedence. 'drupal_system_listing_compatible_test' => array( - 'profiles/testing/modules', + 'core/profiles/testing/modules', 'core/modules/system/tests/modules', ), ); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 75b1fa2..bf2a769 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2616,10 +2616,10 @@ function _system_rebuild_module_data() { $modules = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules', 'name', 0); // Include the install profile in modules that are loaded. + require_once DRUPAL_ROOT . '/core/includes/install.core.inc'; $profile = drupal_get_profile(); - $modules[$profile] = new stdClass(); - $modules[$profile]->name = $profile; - $modules[$profile]->uri = 'profiles/' . $profile . '/' . $profile . '.profile'; + $profiles = install_find_profiles(); + $modules[$profile] = $profiles[$profile]; // Install profile hooks are always executed last. $modules[$profile]->weight = 1000; diff --git a/profiles/minimal/minimal.info b/core/profiles/minimal/minimal.info similarity index 100% rename from profiles/minimal/minimal.info rename to core/profiles/minimal/minimal.info diff --git a/profiles/minimal/minimal.install b/core/profiles/minimal/minimal.install similarity index 100% rename from profiles/minimal/minimal.install rename to core/profiles/minimal/minimal.install diff --git a/profiles/minimal/minimal.profile b/core/profiles/minimal/minimal.profile similarity index 100% rename from profiles/minimal/minimal.profile rename to core/profiles/minimal/minimal.profile diff --git a/profiles/minimal/translations/README.txt b/core/profiles/minimal/translations/README.txt similarity index 100% rename from profiles/minimal/translations/README.txt rename to core/profiles/minimal/translations/README.txt diff --git a/profiles/standard/standard.info b/core/profiles/standard/standard.info similarity index 100% copy from profiles/standard/standard.info copy to core/profiles/standard/standard.info diff --git a/profiles/standard/standard.install b/core/profiles/standard/standard.install similarity index 100% copy from profiles/standard/standard.install copy to core/profiles/standard/standard.install diff --git a/profiles/standard/standard.profile b/core/profiles/standard/standard.profile similarity index 100% copy from profiles/standard/standard.profile copy to core/profiles/standard/standard.profile diff --git a/profiles/standard/translations/README.txt b/core/profiles/standard/translations/README.txt similarity index 100% rename from profiles/standard/translations/README.txt rename to core/profiles/standard/translations/README.txt diff --git a/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info b/core/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info similarity index 100% rename from profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info rename to core/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info diff --git a/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module b/core/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module similarity index 100% rename from profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module rename to core/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module diff --git a/profiles/testing/modules/drupal_system_listing_compatible_test/lib/Drupal/drupal_system_listing_compatible_test/Tests/SystemListingCompatibleTest.php b/core/profiles/testing/modules/drupal_system_listing_compatible_test/lib/Drupal/drupal_system_listing_compatible_test/Tests/SystemListingCompatibleTest.php similarity index 100% rename from profiles/testing/modules/drupal_system_listing_compatible_test/lib/Drupal/drupal_system_listing_compatible_test/Tests/SystemListingCompatibleTest.php rename to core/profiles/testing/modules/drupal_system_listing_compatible_test/lib/Drupal/drupal_system_listing_compatible_test/Tests/SystemListingCompatibleTest.php diff --git a/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info b/core/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info similarity index 100% rename from profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info rename to core/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info diff --git a/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module b/core/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module similarity index 100% rename from profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module rename to core/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module diff --git a/profiles/testing/testing.info b/core/profiles/testing/testing.info similarity index 100% rename from profiles/testing/testing.info rename to core/profiles/testing/testing.info diff --git a/profiles/testing/testing.install b/core/profiles/testing/testing.install similarity index 100% rename from profiles/testing/testing.install rename to core/profiles/testing/testing.install diff --git a/profiles/testing/testing.profile b/core/profiles/testing/testing.profile similarity index 100% rename from profiles/testing/testing.profile rename to core/profiles/testing/testing.profile diff --git a/robots.txt b/robots.txt index d590fbf..62b8729 100644 --- a/robots.txt +++ b/robots.txt @@ -20,7 +20,6 @@ User-agent: * Crawl-delay: 10 # Directories Disallow: /core/ -Disallow: /profiles/ # Files Disallow: /README.txt Disallow: /web.config diff --git a/sites/all/README.txt b/sites/all/README.txt index c897088..cad08bf 100644 --- a/sites/all/README.txt +++ b/sites/all/README.txt @@ -1,7 +1,7 @@ -This directory should be used to place downloaded and custom modules -and themes which are common to all sites. Keeping contributed and -custom modules and themes in the sites directory will aid in upgrading -Drupal core files. Place contributed and custom modules and themes in -the sites/all/modules and sites/all/themes directories respectively. +This directory should be used to place downloaded and custom modules, themes +and profiles which are common to all sites. Keeping contributed and custom +modules and themes in the sites directory will aid in upgrading Drupal core +files. Place contributed and custom modules and themes in the sites/all/modules, +sites/all/profiles and sites/all/themes directories respectively. diff --git a/sites/all/modules/README.txt b/sites/all/profiles/README.txt similarity index 57% copy from sites/all/modules/README.txt copy to sites/all/profiles/README.txt index f4e35b5..2bbf4c9 100644 --- a/sites/all/modules/README.txt +++ b/sites/all/profiles/README.txt @@ -1,4 +1,4 @@ -This directory should be used to place downloaded and custom modules +This directory should be used to place downloaded and custom profiles which are common to all sites. This will allow you to more easily update Drupal core files. diff --git a/profiles/standard/standard.info b/sites/all/profiles/standard2/standard2.info similarity index 97% rename from profiles/standard/standard.info rename to sites/all/profiles/standard2/standard2.info index 4332a59..e2ba277 100644 --- a/profiles/standard/standard.info +++ b/sites/all/profiles/standard2/standard2.info @@ -1,4 +1,4 @@ -name = Standard +name = Standard2 description = Install with commonly used features pre-configured. version = VERSION core = 8.x diff --git a/profiles/standard/standard.install b/sites/all/profiles/standard2/standard2.install similarity index 99% rename from profiles/standard/standard.install rename to sites/all/profiles/standard2/standard2.install index 5c7032a..cd89e33 100644 --- a/profiles/standard/standard.install +++ b/sites/all/profiles/standard2/standard2.install @@ -11,7 +11,7 @@ * * @see system_install() */ -function standard_install() { +function standard2_install() { // Add text formats. $filtered_html_format = array( 'format' => 'filtered_html', diff --git a/profiles/standard/standard.profile b/sites/all/profiles/standard2/standard2.profile similarity index 83% rename from profiles/standard/standard.profile rename to sites/all/profiles/standard2/standard2.profile index d554c93..e274c09 100644 --- a/profiles/standard/standard.profile +++ b/sites/all/profiles/standard2/standard2.profile @@ -9,7 +9,7 @@ * * Allows the profile to alter the site configuration form. */ -function standard_form_install_configure_form_alter(&$form, $form_state) { +function standard2_form_install_configure_form_alter(&$form, $form_state) { // Pre-populate the site name with the server name. $form['site_information']['site_name']['#default_value'] = $_SERVER['SERVER_NAME']; }