Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542

This commit is contained in:
Pantheon Automation 2015-08-27 12:03:05 -07:00 committed by Greg Anderson
parent 3b2511d96d
commit 81ccda77eb
2155 changed files with 54307 additions and 46870 deletions

View file

@ -9,7 +9,6 @@ namespace Drupal\Core\Extension;
use Drupal\Component\Graph\Graph;
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
@ -581,7 +580,7 @@ class ModuleHandler implements ModuleHandlerInterface {
}
// If a new implementation was added, verify that the function exists.
if (!function_exists($module . '_' . $hook)) {
throw new \RuntimeException(SafeMarkup::format('An invalid implementation @function was added by hook_module_implements_alter()', array('@function' => $module . '_' . $hook)));
throw new \RuntimeException("An invalid implementation {$module}_{$hook} was added by hook_module_implements_alter()");
}
}
}

View file

@ -13,7 +13,6 @@ use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Config\PreExistingConfigException;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\DrupalKernelInterface;
use Drupal\Component\Utility\SafeMarkup;
/**
* Default implementation of the module installer.
@ -88,10 +87,7 @@ class ModuleInstaller implements ModuleInstallerInterface {
$module_list = $module_list ? array_combine($module_list, $module_list) : array();
if ($missing_modules = array_diff_key($module_list, $module_data)) {
// One or more of the given modules doesn't exist.
throw new MissingDependencyException(SafeMarkup::format('Unable to install modules %modules due to missing modules %missing.', array(
'%modules' => implode(', ', $module_list),
'%missing' => implode(', ', $missing_modules),
)));
throw new MissingDependencyException(sprintf('Unable to install modules %s due to missing modules %s.', implode(', ', $module_list), implode(', ', $missing_modules)));
}
// Only process currently uninstalled modules.
@ -107,10 +103,7 @@ class ModuleInstaller implements ModuleInstallerInterface {
foreach (array_keys($module_data[$module]->requires) as $dependency) {
if (!isset($module_data[$dependency])) {
// The dependency does not exist.
throw new MissingDependencyException(SafeMarkup::format('Unable to install modules: module %module is missing its dependency module %dependency.', array(
'%module' => $module,
'%dependency' => $dependency,
)));
throw new MissingDependencyException("Unable to install modules: module '$module' is missing its dependency module $dependency.");
}
// Skip already installed modules.
@ -145,10 +138,7 @@ class ModuleInstaller implements ModuleInstallerInterface {
if (!$enabled) {
// Throw an exception if the module name is too long.
if (strlen($module) > DRUPAL_EXTENSION_NAME_MAX_LENGTH) {
throw new ExtensionNameLengthException(format_string('Module name %name is over the maximum allowed length of @max characters.', array(
'%name' => $module,
'@max' => DRUPAL_EXTENSION_NAME_MAX_LENGTH,
)));
throw new ExtensionNameLengthException("Module name '$module' is over the maximum allowed length of " . DRUPAL_EXTENSION_NAME_MAX_LENGTH . ' characters');
}
// Check the validity of the default configuration. This will throw
@ -253,12 +243,11 @@ class ModuleInstaller implements ModuleInstallerInterface {
// Record the fact that it was installed.
$modules_installed[] = $module;
// file_get_stream_wrappers() needs to re-register Drupal's stream
// wrappers in case a module-provided stream wrapper is used later in
// the same request. In particular, this happens when installing Drupal
// via Drush, as the 'translations' stream wrapper is provided by
// Interface Translation module and is later used to import
// translations.
// Drupal's stream wrappers needs to be re-registered in case a
// module-provided stream wrapper is used later in the same request. In
// particular, this happens when installing Drupal via Drush, as the
// 'translations' stream wrapper is provided by Interface Translation
// module and is later used to import translations.
\Drupal::service('stream_wrapper_manager')->register();
// Update the theme registry to include it.
@ -330,9 +319,7 @@ class ModuleInstaller implements ModuleInstallerInterface {
foreach ($reasons as $reason) {
$reason_message[] = implode(', ', $reason);
}
throw new ModuleUninstallValidatorException(format_string('The following reasons prevents the modules from being uninstalled: @reasons', array(
'@reasons' => implode('; ', $reason_message),
)));
throw new ModuleUninstallValidatorException('The following reasons prevents the modules from being uninstalled: ' . implode('; ', $reason_message));
}
// Set the actual module weights.
$module_list = array_map(function ($module) use ($module_data) {

View file

@ -167,7 +167,7 @@ class ThemeHandler implements ThemeHandlerInterface {
public function install(array $theme_list, $install_dependencies = TRUE) {
// We keep the old install() method as BC layer but redirect directly to the
// theme installer.
\Drupal::service('theme_installer')->install($theme_list, $install_dependencies);
return \Drupal::service('theme_installer')->install($theme_list, $install_dependencies);
}
/**
@ -429,7 +429,7 @@ class ThemeHandler implements ThemeHandlerInterface {
public function getName($theme) {
$themes = $this->listInfo();
if (!isset($themes[$theme])) {
throw new \InvalidArgumentException(SafeMarkup::format('Requested the name of a non-existing theme @theme', array('@theme' => $theme)));
throw new \InvalidArgumentException("Requested the name of a non-existing theme $theme");
}
return SafeMarkup::checkPlain($themes[$theme]->info['name']);
}

View file

@ -7,7 +7,6 @@
namespace Drupal\Core\Extension;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Asset\AssetCollectionOptimizerInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\ConfigFactoryInterface;
@ -113,9 +112,7 @@ class ThemeInstaller implements ThemeInstallerInterface {
if ($missing = array_diff_key($theme_list, $theme_data)) {
// One or more of the given themes doesn't exist.
throw new \InvalidArgumentException(SafeMarkup::format('Unknown themes: !themes.', array(
'!themes' => implode(', ', $missing),
)));
throw new \InvalidArgumentException('Unknown themes: ' . implode(', ', $missing) . '.');
}
// Only process themes that are not installed currently.
@ -164,10 +161,7 @@ class ThemeInstaller implements ThemeInstallerInterface {
// Throw an exception if the theme name is too long.
if (strlen($key) > DRUPAL_EXTENSION_NAME_MAX_LENGTH) {
throw new ExtensionNameLengthException(SafeMarkup::format('Theme name %name is over the maximum allowed length of @max characters.', array(
'%name' => $key,
'@max' => DRUPAL_EXTENSION_NAME_MAX_LENGTH,
)));
throw new ExtensionNameLengthException("Theme name $key is over the maximum allowed length of " . DRUPAL_EXTENSION_NAME_MAX_LENGTH . ' characters.');
}
// Validate default configuration of the theme. If there is existing

View file

@ -125,6 +125,8 @@ function hook_module_preinstall($module) {
* \Drupal\Core\Extension\ModuleHandler::install() for a detailed description of
* the order in which install hooks are invoked.
*
* This hook should be implemented in a .module file, not in an .install file.
*
* @param $modules
* An array of the modules that were installed.
*
@ -464,11 +466,30 @@ function hook_install_tasks_alter(&$tasks, $install_state) {
* In order to call a function from your mymodule.module or an include file,
* you need to explicitly load that file first.
*
* During database updates the schema of any module could be out of date. For
* this reason, caution is needed when using any API function within an update
* Implementations must ensure that APIs used are safe during updates. During
* database updates the schema of any module could be out of date. For this
* reason, caution is needed when using any API function within an update
* function - particularly CRUD functions, functions that depend on the schema
* (for example by using drupal_write_record()), and any functions that invoke
* hooks.
* (for example by using \Drupal\Core\Entity\Entity::save()), and any functions
* that invoke hooks.
*
* The following actions are examples that are safe:
* - Cache invalidation.
* - Using \Drupal::configFactory()->getEditable() and \Drupal::config().
* Implementations must:
* - Not make any assumption that the config data is valid.
* - Use the correct data type when changing configuration values as specified
* by its configuration schema at the time the update hook is written. If
* the data type changes in a subsequent code change, a subsequent update
* hook is responsible for ensuring the final data type aligns with the
* configuration schema.
* - Use the $has_trusted_data argument for \Drupal\Core\Config\Config::save()
* so that configuration schemas are not used whilst saving configuration.
* - Marking a container for rebuild.
*
* The following actions are examples that are unsafe:
* - Loading, saving, or performing any other operation on an entity.
* - Rebuilding the router using \Drupal::service('router.builder')->rebuild().
*
* The $sandbox parameter should be used when a multipass update is needed, in
* circumstances where running the whole update at once could cause PHP to