Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -111,6 +111,30 @@ function drupal_install_profile_distribution_name() {
return isset($info['distribution']['name']) ? $info['distribution']['name'] : 'Drupal';
}
/**
* Loads the installation profile, extracting its defined version.
*
* @return string Distribution version defined in the profile's .info.yml file.
* Defaults to \Drupal::VERSION if no version is explicitly provided
* by the installation profile.
*
* @see install_profile_info()
*/
function drupal_install_profile_distribution_version() {
// During installation, the profile information is stored in the global
// installation state (it might not be saved anywhere yet).
if (drupal_installation_attempted()) {
global $install_state;
return isset($install_state['profile_info']['version']) ? $install_state['profile_info']['version'] : \Drupal::VERSION;
}
// At all other times, we load the profile via standard methods.
else {
$profile = drupal_get_profile();
$info = system_get_info('module', $profile);
return $info['version'];
}
}
/**
* Detects all supported databases that are compiled into PHP.
*
@ -178,12 +202,8 @@ function drupal_get_database_types() {
* and comment properties.
* @code
* $settings['config_directories'] = array(
* CONFIG_ACTIVE_DIRECTORY => (object) array(
* 'value' => 'config_hash/active'
* 'required' => TRUE,
* ),
* CONFIG_STAGING_DIRECTORY => (object) array(
* 'value' => 'config_hash/staging',
* CONFIG_SYNC_DIRECTORY => (object) array(
* 'value' => 'config_hash/sync',
* 'required' => TRUE,
* ),
* );
@ -191,7 +211,7 @@ function drupal_get_database_types() {
* gets dumped as:
* @code
* $config_directories['active'] = 'config_hash/active';
* $config_directories['staging'] = 'config_hash/staging'
* $config_directories['sync'] = 'config_hash/sync'
* @endcode
*/
function drupal_rewrite_settings($settings = array(), $settings_file = NULL) {
@ -467,15 +487,9 @@ function drupal_install_config_directories() {
// manually defined in the existing already.
$settings = [];
$config_directories_hash = Crypt::randomBytesBase64(55);
if (empty($config_directories[CONFIG_ACTIVE_DIRECTORY])) {
$settings['config_directories'][CONFIG_ACTIVE_DIRECTORY] = (object) [
'value' => \Drupal::service('site.path') . '/files/config_' . $config_directories_hash . '/active',
'required' => TRUE,
];
}
if (empty($config_directories[CONFIG_STAGING_DIRECTORY])) {
$settings['config_directories'][CONFIG_STAGING_DIRECTORY] = (object) [
'value' => \Drupal::service('site.path') . '/files/config_' . $config_directories_hash . '/staging',
if (empty($config_directories[CONFIG_SYNC_DIRECTORY])) {
$settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) [
'value' => \Drupal::service('site.path') . '/files/config_' . $config_directories_hash . '/sync',
'required' => TRUE,
];
}
@ -485,36 +499,25 @@ function drupal_install_config_directories() {
drupal_rewrite_settings($settings);
}
// Ensure the config directories exist or can be created, and are writable.
foreach (array(CONFIG_ACTIVE_DIRECTORY, CONFIG_STAGING_DIRECTORY) as $config_type) {
// This should never fail, since if the config directory was specified in
// settings.php it will have already been created and verified earlier, and
// if it wasn't specified in settings.php, it is created here inside the
// public files directory, which has already been verified to be writable
// itself. But if it somehow fails anyway, the installation cannot proceed.
// Bail out using a similar error message as in system_requirements().
if (!install_ensure_config_directory($config_type)) {
throw new Exception(t('The directory %directory could not be created or could not be made writable. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see the <a href="@handbook_url">online handbook</a>.', array(
'%directory' => config_get_config_directory($config_type),
'@handbook_url' => 'https://www.drupal.org/server-permissions',
)));
}
// Put a README.txt into each config directory. This is required so that
// they can later be added to git. Since these directories are auto-
// created, we have to write out the README rather than just adding it
// to the drupal core repo.
switch ($config_type) {
case CONFIG_ACTIVE_DIRECTORY:
$text = 'If you change the configuration system to use file storage instead of the database for the active Drupal site configuration, this directory will contain the active configuration. By default, this directory will be empty. If you are using files to store the active configuration, and you want to move it between environments, files from this directory should be placed in the staging directory on the target server. To make this configuration active, visit admin/config/development/configuration/sync on the target server.';
break;
case CONFIG_STAGING_DIRECTORY:
$text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.';
break;
}
$text .= ' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config';
file_put_contents(config_get_config_directory($config_type) . '/README.txt', $text);
// This should never fail, since if the config directory was specified in
// settings.php it will have already been created and verified earlier, and
// if it wasn't specified in settings.php, it is created here inside the
// public files directory, which has already been verified to be writable
// itself. But if it somehow fails anyway, the installation cannot proceed.
// Bail out using a similar error message as in system_requirements().
if (!install_ensure_config_directory(CONFIG_SYNC_DIRECTORY)) {
throw new Exception(t('The directory %directory could not be created or could not be made writable. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see the <a href=":handbook_url">online handbook</a>.', array(
'%directory' => config_get_config_directory(CONFIG_SYNC_DIRECTORY),
':handbook_url' => 'https://www.drupal.org/server-permissions',
)));
}
// Put a README.txt into the sync config directory. This is required so that
// they can later be added to git. Since this directory is auto-created, we
// have to write out the README rather than just adding it to the drupal core
// repo.
$text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.' .' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config';
file_put_contents(config_get_config_directory(CONFIG_SYNC_DIRECTORY) . '/README.txt', $text);
}
/**
@ -522,7 +525,7 @@ function drupal_install_config_directories() {
*
* @param string $type
* Type of config directory to return. Drupal core provides 'active' and
* 'staging'.
* 'sync'.
*
* @return bool
* TRUE if the config directory exists and is writable.
@ -570,16 +573,22 @@ function drupal_verify_profile($install_state) {
$requirements = array();
if (count($missing_modules)) {
$modules = array();
if ($missing_modules) {
$build = [
'#theme' => 'item_list',
'#context' => ['list_style' => 'comma-list'],
];
foreach ($missing_modules as $module) {
$modules[] = '<span class="admin-missing">' . Unicode::ucfirst($module) . '</span>';
$build['#items'][] = array('#markup' => '<span class="admin-missing">' . Unicode::ucfirst($module) . '</span>');
}
$modules_list = \Drupal::service('renderer')->renderPlain($build);
$requirements['required_modules'] = array(
'title' => t('Required modules'),
'value' => t('Required modules not found.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The following modules are required but were not found. Move them into the appropriate modules subdirectory, such as <em>/modules</em>. Missing modules: !modules', array('!modules' => implode(', ', $modules))),
'title' => t('Required modules'),
'value' => t('Required modules not found.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The following modules are required but were not found. Move them into the appropriate modules subdirectory, such as <em>/modules</em>. Missing modules: @modules', array('@modules' => $modules_list)),
);
}
return $requirements;