Update to Drupal 8.2.6. For more information, see https://www.drupal.org/project/drupal/releases/8.2.6

This commit is contained in:
Pantheon Automation 2017-02-02 16:28:38 -08:00 committed by Greg Anderson
parent db56c09587
commit f1e72395cb
588 changed files with 26857 additions and 2777 deletions

View file

@ -59,8 +59,8 @@ class ApcClassLoader
/**
* Constructor.
*
* @param string $prefix The APC namespace prefix to use.
* @param object $decorated A class loader object that implements the findFile() method.
* @param string $prefix The APC namespace prefix to use
* @param object $decorated A class loader object that implements the findFile() method
*
* @throws \RuntimeException
* @throws \InvalidArgumentException
@ -122,8 +122,10 @@ class ApcClassLoader
*/
public function findFile($class)
{
if (false === $file = apcu_fetch($this->prefix.$class)) {
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class));
$file = apcu_fetch($this->prefix.$class, $success);
if (!$success) {
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null);
}
return $file;

View file

@ -92,8 +92,10 @@ class ApcUniversalClassLoader extends UniversalClassLoader
*/
public function findFile($class)
{
if (false === $file = apcu_fetch($this->prefix.$class)) {
apcu_store($this->prefix.$class, $file = parent::findFile($class));
$file = apcu_fetch($this->prefix.$class, $success);
if (!$success) {
apcu_store($this->prefix.$class, $file = parent::findFile($class) ?: null);
}
return $file;

View file

@ -43,12 +43,12 @@ class ClassCollectionLoader
self::$loaded[$name] = true;
$declared = array_merge(get_declared_classes(), get_declared_interfaces());
if (function_exists('get_declared_traits')) {
$declared = array_merge($declared, get_declared_traits());
}
if ($adaptive) {
$declared = array_merge(get_declared_classes(), get_declared_interfaces());
if (function_exists('get_declared_traits')) {
$declared = array_merge($declared, get_declared_traits());
}
// don't include already declared classes
$classes = array_diff($classes, $declared);
@ -58,6 +58,11 @@ class ClassCollectionLoader
$classes = array_unique($classes);
// cache the core classes
if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) {
throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir));
}
$cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.DIRECTORY_SEPARATOR);
$cache = $cacheDir.'/'.$name.$extension;
// auto-reload
@ -87,12 +92,29 @@ class ClassCollectionLoader
}
}
if (!$reload && is_file($cache)) {
if (!$reload && file_exists($cache)) {
require_once $cache;
return;
}
if (!$adaptive) {
$declared = array_merge(get_declared_classes(), get_declared_interfaces());
if (function_exists('get_declared_traits')) {
$declared = array_merge($declared, get_declared_traits());
}
}
$spacesRegex = '(?:\s*+(?:(?:\#|//)[^\n]*+\n|/\*(?:(?<!\*/).)++)?+)*+';
$dontInlineRegex = <<<REGEX
'(?:
^<\?php\s.declare.\(.strict_types.=.1.\).;
| \b__halt_compiler.\(.\)
| \b__(?:DIR|FILE)__\b
)'isx
REGEX;
$dontInlineRegex = str_replace('.', $spacesRegex, $dontInlineRegex);
$cacheDir = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $cacheDir));
$files = array();
$content = '';
foreach (self::getOrderedClasses($classes) as $class) {
@ -100,25 +122,40 @@ class ClassCollectionLoader
continue;
}
$files[] = $class->getFileName();
$files[] = $file = $class->getFileName();
$c = file_get_contents($file);
$c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($class->getFileName()));
if (preg_match($dontInlineRegex, $c)) {
$file = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $file));
// fakes namespace declaration for global code
if (!$class->inNamespace()) {
$c = "\nnamespace\n{\n".$c."\n}\n";
for ($i = 0; isset($file[$i], $cacheDir[$i]); ++$i) {
if ($file[$i] !== $cacheDir[$i]) {
break;
}
}
if (1 >= $i) {
$file = var_export(implode('/', $file), true);
} else {
$file = array_slice($file, $i);
$file = str_repeat('../', count($cacheDir) - $i).implode('/', $file);
$file = '__DIR__.'.var_export('/'.$file, true);
}
$c = "\nnamespace {require $file;}";
} else {
$c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', $c);
// fakes namespace declaration for global code
if (!$class->inNamespace()) {
$c = "\nnamespace\n{\n".$c."\n}\n";
}
$c = self::fixNamespaceDeclarations('<?php '.$c);
$c = preg_replace('/^\s*<\?php/', '', $c);
}
$c = self::fixNamespaceDeclarations('<?php '.$c);
$c = preg_replace('/^\s*<\?php/', '', $c);
$content .= $c;
}
// cache the core classes
if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) {
throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir));
}
self::writeCacheFile($cache, '<?php '.$content);
if ($autoReload) {
@ -238,7 +275,13 @@ class ClassCollectionLoader
*/
private static function writeCacheFile($file, $content)
{
$tmpFile = tempnam(dirname($file), basename($file));
$dir = dirname($file);
if (!is_writable($dir)) {
throw new \RuntimeException(sprintf('Cache directory "%s" is not writable.', $dir));
}
$tmpFile = tempnam($dir, basename($file));
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
@chmod($file, 0666 & ~umask());

View file

@ -64,7 +64,7 @@ class ClassMapGenerator
continue;
}
$path = $file->getRealPath();
$path = $file->getRealPath() ?: $file->getPathname();
if (pathinfo($path, PATHINFO_EXTENSION) !== 'php') {
continue;

View file

@ -89,7 +89,7 @@ class DebugClassLoader
*/
public function findFile($class)
{
return $this->classFinder->findFile($class);
return $this->classFinder->findFile($class) ?: null;
}
/**

View file

@ -1,4 +1,4 @@
Copyright (c) 2004-2016 Fabien Potencier
Copyright (c) 2004-2017 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -60,8 +60,8 @@ class WinCacheClassLoader
/**
* Constructor.
*
* @param string $prefix The WinCache namespace prefix to use.
* @param object $decorated A class loader object that implements the findFile() method.
* @param string $prefix The WinCache namespace prefix to use
* @param object $decorated A class loader object that implements the findFile() method
*
* @throws \RuntimeException
* @throws \InvalidArgumentException
@ -123,8 +123,10 @@ class WinCacheClassLoader
*/
public function findFile($class)
{
if (false === $file = wincache_ucache_get($this->prefix.$class)) {
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class), 0);
$file = wincache_ucache_get($this->prefix.$class, $success);
if (!$success) {
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null, 0);
}
return $file;

View file

@ -60,8 +60,8 @@ class XcacheClassLoader
/**
* Constructor.
*
* @param string $prefix The XCache namespace prefix to use.
* @param object $decorated A class loader object that implements the findFile() method.
* @param string $prefix The XCache namespace prefix to use
* @param object $decorated A class loader object that implements the findFile() method
*
* @throws \RuntimeException
* @throws \InvalidArgumentException
@ -126,7 +126,7 @@ class XcacheClassLoader
if (xcache_isset($this->prefix.$class)) {
$file = xcache_get($this->prefix.$class);
} else {
$file = $this->decorated->findFile($class);
$file = $this->decorated->findFile($class) ?: null;
xcache_set($this->prefix.$class, $file);
}