Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023

This commit is contained in:
Pantheon Automation 2015-09-04 13:20:09 -07:00 committed by Greg Anderson
parent 2720a9ec4b
commit f3791f1da3
1898 changed files with 54300 additions and 11481 deletions

View file

@ -70,7 +70,7 @@ class Error {
'%type' => get_class($exception),
// The standard PHP exception handler considers that the exception message
// is plain-text. We mimic this behavior here.
'!message' => SafeMarkup::checkPlain($message),
'@message' => $message,
'%function' => $caller['function'],
'%file' => $caller['file'],
'%line' => $caller['line'],
@ -95,14 +95,13 @@ class Error {
// Remove 'main()'.
array_shift($backtrace);
$output = SafeMarkup::format('%type: !message in %function (line %line of %file).', $decode);
// Even though it is possible that this method is called on a public-facing
// site, it is only called when the exception handler itself threw an
// exception, which normally means that a code change caused the system to
// no longer function correctly (as opposed to a user-triggered error), so
// we assume that it is safe to include a verbose backtrace.
$output .= '<pre>' . static::formatBacktrace($backtrace) . '</pre>';
return SafeMarkup::set($output);
$decode['@backtrace'] = Error::formatBacktrace($backtrace);
return SafeMarkup::format('%type: @message in %function (line %line of %file). <pre class="backtrace">@backtrace</pre>', $decode);
}
/**

View file

@ -19,9 +19,8 @@ class ProjectInfo {
/**
* Populates an array of project data.
*
* @todo https://www.drupal.org/node/2338167 update class since extensions can
* no longer be hidden, enabled or disabled. Additionally, base themes have
* to be installed for sub themes to work.
* @todo https://www.drupal.org/node/2553909 update class since extensions can
* no longer be disabled.
*
* This iterates over a list of the installed modules or themes and groups
* them by project and status. A few parts of this function assume that
@ -29,10 +28,12 @@ class ProjectInfo {
* modules or themes are being processed (there is a setting to control if
* disabled code should be included in the Available updates report or not),
* those are only processed after $projects has been populated with
* information about the enabled code. 'Hidden' modules are always ignored.
* 'Hidden' themes are ignored only if they have no enabled sub-themes.
* This function also records the latest change time on the .info.yml
* files for each module or theme, which is important data which is used when
* information about the enabled code. 'Hidden' modules and themes are
* ignored if they are not installed. 'Hidden' Modules and themes in the
* "Testing" package are ignored regardless of installation status.
*
* This function also records the latest change time on the .info.yml files
* for each module or theme, which is important data which is used when
* deciding if the available update data should be invalidated.
*
* @param array $projects
@ -50,25 +51,8 @@ class ProjectInfo {
*/
function processInfoList(array &$projects, array $list, $project_type, $status, array $additional_whitelist = array()) {
foreach ($list as $file) {
// A disabled or hidden base theme of an enabled sub-theme still has all
// of its code run by the sub-theme, so we include it in our "enabled"
// projects list.
if ($status && !empty($file->sub_themes)) {
foreach ($file->sub_themes as $key => $name) {
// Build a list of installed sub-themes.
if ($list[$key]->status) {
$file->installed_sub_themes[$key] = $name;
}
}
// If the theme is uninstalled and there are no installed subthemes, we
// should ignore this base theme for the installed case. If the site is
// trying to display uninstalled themes, we'll catch it then.
if (!$file->status && empty($file->installed_sub_themes)) {
continue;
}
}
// Otherwise, just add projects of the proper status to our list.
elseif ($file->status != $status) {
// Just projects with a matching status should be listed.
if ($file->status != $status) {
continue;
}
@ -77,9 +61,15 @@ class ProjectInfo {
continue;
}
// Skip if it's a hidden module or hidden theme without installed
// sub-themes.
if (!empty($file->info['hidden']) && empty($file->installed_sub_themes)) {
// Skip if it's a hidden project and the project is not installed.
if (!empty($file->info['hidden']) && empty($status)) {
continue;
}
// Skip if it's a hidden project and the project is a test project. Tests
// should use hook_system_info_alter() to test ProjectInfo's
// functionality.
if (!empty($file->info['hidden']) && isset($file->info['package']) && $file->info['package'] == 'Testing') {
continue;
}
@ -120,25 +110,10 @@ class ProjectInfo {
else {
$project_display_type = $project_type;
}
if (empty($status) && empty($file->installed_sub_themes)) {
if (empty($status)) {
// If we're processing disabled modules or themes, append a suffix.
// However, we don't do this to a base theme with installed
// subthemes, since we treat that case as if it is installed.
$project_display_type .= '-disabled';
}
// Add a list of sub-themes that "depend on" the project and a list of base
// themes that are "required by" the project.
if ($project_name == 'drupal') {
// Drupal core is always required, so this extra info would be noise.
$sub_themes = array();
$base_themes = array();
}
else {
// Add list of installed sub-themes.
$sub_themes = !empty($file->installed_sub_themes) ? $file->installed_sub_themes : array();
// Add list of base themes.
$base_themes = !empty($file->base_themes) ? $file->base_themes : array();
}
if (!isset($projects[$project_name])) {
// Only process this if we haven't done this project, since a single
// project can have multiple modules or themes.
@ -151,8 +126,6 @@ class ProjectInfo {
'includes' => array($file->getName() => $file->info['name']),
'project_type' => $project_display_type,
'project_status' => $status,
'sub_themes' => $sub_themes,
'base_themes' => $base_themes,
);
}
elseif ($projects[$project_name]['project_type'] == $project_display_type) {
@ -164,12 +137,6 @@ class ProjectInfo {
$projects[$project_name]['includes'][$file->getName()] = $file->info['name'];
$projects[$project_name]['info']['_info_file_ctime'] = max($projects[$project_name]['info']['_info_file_ctime'], $file->info['_info_file_ctime']);
$projects[$project_name]['datestamp'] = max($projects[$project_name]['datestamp'], $file->info['datestamp']);
if (!empty($sub_themes)) {
$projects[$project_name]['sub_themes'] += $sub_themes;
}
if (!empty($base_themes)) {
$projects[$project_name]['base_themes'] += $base_themes;
}
}
elseif (empty($status)) {
// If we have a project_name that matches, but the project_display_type

View file

@ -5,7 +5,7 @@
* Hooks related to the Token system.
*/
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Html;
use Drupal\user\Entity\User;
/**
@ -97,7 +97,7 @@ function hook_tokens($type, $tokens, array $data, array $options, \Drupal\Core\R
break;
case 'title':
$replacements[$original] = $sanitize ? SafeMarkup::checkPlain($node->getTitle()) : $node->getTitle();
$replacements[$original] = $sanitize ? Html::escape($node->getTitle()) : $node->getTitle();
break;
case 'edit-url':
@ -107,7 +107,7 @@ function hook_tokens($type, $tokens, array $data, array $options, \Drupal\Core\R
// Default values for the chained tokens handled below.
case 'author':
$account = $node->getOwner() ? $node->getOwner() : User::load(0);
$replacements[$original] = $sanitize ? SafeMarkup::checkPlain($account->label()) : $account->label();
$replacements[$original] = $sanitize ? Html::escape($account->label()) : $account->label();
$bubbleable_metadata->addCacheableDependency($account);
break;