Update to Drupal 8.1.1. For more information, see https://www.drupal.org/node/2718713

This commit is contained in:
Pantheon Automation 2016-05-04 14:35:41 -07:00 committed by Greg Anderson
parent c0a0d5a94c
commit 9eae24d844
669 changed files with 3873 additions and 1553 deletions

View file

@ -214,7 +214,7 @@ class AssetResolver implements AssetResolverInterface {
// hook_library_info_alter(). Additionally add the current language to
// support translation of JavaScript files via hook_js_alter().
$libraries_to_load = $this->getLibrariesToLoad($assets);
$cid = 'js:' . $theme_info->getName() . ':' . $this->languageManager->getCurrentLanguage()->getId() . ':' . Crypt::hashBase64(serialize($libraries_to_load)) . (int) (count($assets->getSettings()) > 0) . (int) $optimize;
$cid = 'js:' . $theme_info->getName() . ':' . $this->languageManager->getCurrentLanguage()->getId() . ':' . Crypt::hashBase64(serialize($libraries_to_load) . serialize($assets->getLibraries())) . (int) (count($assets->getSettings()) > 0) . (int) $optimize;
if ($cached = $this->cache->get($cid)) {
list($js_assets_header, $js_assets_footer, $settings, $settings_in_header) = $cached->data;

View file

@ -12,8 +12,8 @@ class CssCollectionGrouper implements AssetCollectionGrouperInterface {
*
* Puts multiple items into the same group if they are groupable and if they
* are for the same 'media' and 'browsers'. Items of the 'file' type are
* groupable if their 'preprocess' flag is TRUE, items of the 'inline' type
* are always groupable, and items of the 'external' type are never groupable.
* groupable if their 'preprocess' flag is TRUE, and items of the 'external'
* type are never groupable.
*
* Also ensures that the process of grouping items does not change their
* relative order. This requirement may result in multiple groups for the same
@ -55,11 +55,6 @@ class CssCollectionGrouper implements AssetCollectionGrouperInterface {
$group_keys = $item['preprocess'] ? array($item['type'], $item['group'], $item['media'], $item['browsers']) : FALSE;
break;
case 'inline':
// Always group inline items.
$group_keys = array($item['type'], $item['media'], $item['browsers']);
break;
case 'external':
// Do not group external items.
$group_keys = FALSE;

View file

@ -133,16 +133,6 @@ class CssCollectionOptimizer implements AssetCollectionOptimizerInterface {
}
break;
case 'inline':
// We don't do any caching for inline CSS assets.
$data = '';
foreach ($css_group['items'] as $css_asset) {
$data .= $this->optimizer->optimize($css_asset);
}
unset($css_assets[$order]['data']['items']);
$css_assets[$order]['data'] = $data;
break;
case 'external':
// We don't do any aggregation and hence also no caching for external
// CSS assets.

View file

@ -20,19 +20,14 @@ class CssOptimizer implements AssetOptimizerInterface {
* {@inheritdoc}
*/
public function optimize(array $css_asset) {
if (!in_array($css_asset['type'], array('file', 'inline'))) {
throw new \Exception('Only file or inline CSS assets can be optimized.');
if ($css_asset['type'] != 'file') {
throw new \Exception('Only file CSS assets can be optimized.');
}
if ($css_asset['type'] === 'file' && !$css_asset['preprocess']) {
if (!$css_asset['preprocess']) {
throw new \Exception('Only file CSS assets with preprocessing enabled can be optimized.');
}
if ($css_asset['type'] === 'file') {
return $this->processFile($css_asset);
}
else {
return $this->processCss($css_asset['data'], $css_asset['preprocess']);
}
return $this->processFile($css_asset);
}
/**
@ -241,14 +236,14 @@ class CssOptimizer implements AssetOptimizerInterface {
/**
* Prefixes all paths within a CSS file for processFile().
*
* @param array $matches
* An array of matches by a preg_replace_callback() call that scans for
* url() references in CSS files, except for external or absolute ones.
*
* Note: the only reason this method is public is so color.module can call it;
* it is not on the AssetOptimizerInterface, so future refactorings can make
* it protected.
*
* @param array $matches
* An array of matches by a preg_replace_callback() call that scans for
* url() references in CSS files, except for external or absolute ones.
*
* @return string
* The file path.
*/

View file

@ -12,8 +12,7 @@ class JsCollectionGrouper implements AssetCollectionGrouperInterface {
*
* Puts multiple items into the same group if they are groupable and if they
* are for the same browsers. Items of the 'file' type are groupable if their
* 'preprocess' flag is TRUE. Items of the 'inline', 'settings', or 'external'
* type are not groupable.
* 'preprocess' flag is TRUE. Items of the 'external' type are not groupable.
*
* Also ensures that the process of grouping items does not change their
* relative order. This requirement may result in multiple groups for the same
@ -43,9 +42,7 @@ class JsCollectionGrouper implements AssetCollectionGrouperInterface {
break;
case 'external':
case 'setting':
case 'inline':
// Do not group external, settings, and inline items.
// Do not group external items.
$group_keys = FALSE;
break;
}

View file

@ -138,10 +138,8 @@ class JsCollectionOptimizer implements AssetCollectionOptimizerInterface {
break;
case 'external':
case 'setting':
case 'inline':
// We don't do any aggregation and hence also no caching for external,
// setting or inline JS assets.
// We don't do any aggregation and hence also no caching for external
// JS assets.
$uri = $js_group['items'][0]['data'];
$js_assets[$order]['data'] = $uri;
break;

View file

@ -68,7 +68,7 @@ class JsCollectionRenderer implements AssetCollectionRendererInterface {
'type' => 'application/json',
'data-drupal-selector' => 'drupal-settings-json',
);
$element['#value'] = Json::encode($js_asset['data']);
$element['#value'] = Json::encode($js_asset['data']);
break;
case 'file':

View file

@ -16,7 +16,7 @@ class JsOptimizer implements AssetOptimizerInterface {
if ($js_asset['type'] !== 'file') {
throw new \Exception('Only file JavaScript assets can be optimized.');
}
if ($js_asset['type'] === 'file' && !$js_asset['preprocess']) {
if (!$js_asset['preprocess']) {
throw new \Exception('Only file JavaScript assets with preprocessing enabled can be optimized.');
}